diff --git a/proposal/myrmidon/build.xml b/proposal/myrmidon/build.xml
index 90a08d6ae..139456060 100644
--- a/proposal/myrmidon/build.xml
+++ b/proposal/myrmidon/build.xml
@@ -64,7 +64,7 @@ Legal:
-
+
@@ -516,7 +516,7 @@ Legal:
-
@@ -535,7 +535,7 @@ Legal:
-
+
@@ -571,7 +571,7 @@ Legal:
-
+
diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/conditions/IsSetCondition.java b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/conditions/IsSetCondition.java
index 6c5d39348..ed20d4d82 100644
--- a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/conditions/IsSetCondition.java
+++ b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/conditions/IsSetCondition.java
@@ -26,8 +26,8 @@ import org.apache.myrmidon.api.TaskException;
public class IsSetCondition
implements Condition
{
- private final static Resources REZ
- = ResourceManager.getPackageResources( IsSetCondition.class );
+ private final static Resources REZ =
+ ResourceManager.getPackageResources( IsSetCondition.class );
private String m_property;
diff --git a/proposal/myrmidon/src/test/org/apache/aut/bzip2/test/BzipTestCase.java b/proposal/myrmidon/src/test/org/apache/aut/bzip2/test/BzipTestCase.java
index 2bd65da42..fb3e0a07b 100644
--- a/proposal/myrmidon/src/test/org/apache/aut/bzip2/test/BzipTestCase.java
+++ b/proposal/myrmidon/src/test/org/apache/aut/bzip2/test/BzipTestCase.java
@@ -104,7 +104,7 @@ public class BzipTestCase
private InputStream getInputStream( final String resource )
throws Exception
{
- final String filename = "src" + File.separator + "testcases" + File.separator +
+ final String filename = "src" + File.separator + "test" + File.separator +
getClass().getName().replace( '.', File.separatorChar );
final String path = FileUtil.getPath( filename );
final File input = new File( path, resource );
diff --git a/proposal/myrmidon/src/testcases/org/apache/antlib/core/test/IfTestCase.java b/proposal/myrmidon/src/testcases/org/apache/antlib/core/test/IfTestCase.java
deleted file mode 100644
index b71d5fd4d..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/antlib/core/test/IfTestCase.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.antlib.core.test;
-
-import java.io.File;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.AbstractProjectTest;
-import org.apache.myrmidon.LogMessageTracker;
-
-/**
- * Test cases for the task.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class IfTestCase
- extends AbstractProjectTest
-{
- private final static Resources REZ = getResourcesForTested( IfTestCase.class );
-
- public IfTestCase( String name )
- {
- super( name );
- }
-
- /**
- * Test checking whether a property is set and not 'false'.
- */
- public void testConditions()
- throws Exception
- {
- final File projectFile = getTestResource( "if.ant" );
-
- // Test when property is set to 'true'
- LogMessageTracker listener = new LogMessageTracker();
- listener.addExpectedMessage( "true-prop", "test-prop is set" );
- executeTarget( projectFile, "true-prop", listener );
-
- // Test when property is set to a value other than 'true' or 'false'
- listener = new LogMessageTracker();
- listener.addExpectedMessage( "set-prop", "test-prop is set" );
- executeTarget( projectFile, "set-prop", listener );
-
- // Test when property is set to 'false'
- listener = new LogMessageTracker();
- listener.addExpectedMessage( "false-prop", "test-prop is not set" );
- executeTarget( projectFile, "false-prop", listener );
-
- // Test when property is not set
- listener = new LogMessageTracker();
- listener.addExpectedMessage( "not-set-prop", "test-prop is not set" );
- executeTarget( projectFile, "not-set-prop", listener );
- }
-
- /**
- * Tests that the task can handle multiple nested tasks.
- */
- public void testMultipleTasks() throws Exception
- {
- final File projectFile = getTestResource( "if.ant" );
-
- // Test when property is not set
- LogMessageTracker listener = new LogMessageTracker();
- listener.addExpectedMessage( "multiple-nested-tasks", "task 1" );
- listener.addExpectedMessage( "multiple-nested-tasks", "task 2" );
- listener.addExpectedMessage( "multiple-nested-tasks", "task 3" );
- listener.addExpectedMessage( "multiple-nested-tasks", "task 4" );
- executeTarget( projectFile, "multiple-nested-tasks", listener );
- }
-
- /**
- * Tests validation.
- */
- public void testValidation() throws Exception
- {
- final File projectFile = getTestResource( "if.ant" );
-
- // Check for missing condition
- String[] messages = {
- null,
- REZ.getString( "if.no-condition.error" )
- };
- executeTargetExpectError( projectFile, "no-condition", messages );
-
- // Check for too many conditions
- messages = new String[]
- {
- null,
- null,
- REZ.getString( "if.ifelse-duplicate.error" )
- };
- executeTargetExpectError( projectFile, "too-many-conditions", messages );
- }
-
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/antlib/core/test/PropertyTestCase.java b/proposal/myrmidon/src/testcases/org/apache/antlib/core/test/PropertyTestCase.java
deleted file mode 100644
index b4f43f075..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/antlib/core/test/PropertyTestCase.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.antlib.core.test;
-
-import java.io.File;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.AbstractProjectTest;
-import org.apache.myrmidon.LogMessageTracker;
-import org.apache.myrmidon.components.workspace.DefaultTaskContext;
-
-/**
- * Test cases for task.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class PropertyTestCase
- extends AbstractProjectTest
-{
- private final static Resources REZ = getResourcesForTested( PropertyTestCase.class );
-
- public PropertyTestCase( final String name )
- {
- super( name );
- }
-
- /**
- * Tests setting a property, using an attribute, text content, and
- * nested element.
- */
- public void testSetProperty()
- throws Exception
- {
- final File projectFile = getTestResource( "property.ant" );
-
- // Set by attribute
- LogMessageTracker tracker = new LogMessageTracker();
- tracker.addExpectedMessage( "set-attr", "test-prop = [some value]" );
- executeTarget( projectFile, "set-attr", tracker );
-
- // Set by text content
- tracker = new LogMessageTracker();
- tracker.addExpectedMessage( "set-content", "test-prop2 = [some value]" );
- executeTarget( projectFile, "set-content", tracker );
-
- // Set by nested element
- tracker = new LogMessageTracker();
- tracker.addExpectedMessage( "set-element", "test-prop3 = [value=[some value]]" );
- executeTarget( projectFile, "set-element", tracker );
- }
-
- /**
- * Tests the validation performed by the propery task.
- */
- public void testValidation()
- throws Exception
- {
- final File projectFile = getTestResource( "property.ant" );
-
- // Missing name
- String[] messages =
- {
- null,
- REZ.getString( "property.no-name.error" )
- };
- executeTargetExpectError( projectFile, "missing-name", messages );
-
- // Missing value
- messages = new String[]
- {
- null,
- REZ.getString( "property.no-value.error" )
- };
- executeTargetExpectError( projectFile, "missing-value", messages );
-
- // Too many values
- messages = new String[]
- {
- null,
- null,
- REZ.getString( "property.multi-set.error" )
- };
- executeTargetExpectError( projectFile, "too-many-values1", messages );
- executeTargetExpectError( projectFile, "too-many-values2", messages );
- executeTargetExpectError( projectFile, "too-many-values3", messages );
- }
-
- /**
- * Tests basic validation of property names.
- */
- public void testNameValidation() throws Exception
- {
- final File projectFile = getTestResource( "property.ant" );
-
- final Resources contextResources
- = ResourceManager.getPackageResources( DefaultTaskContext.class );
-
- // Invalid names
- String[] messages = new String[]
- {
- null,
- contextResources.getString( "bad-property-name.error" ),
- null
- };
- executeTargetExpectError( projectFile, "bad-prop-name1", messages );
- executeTargetExpectError( projectFile, "bad-prop-name2", messages );
- executeTargetExpectError( projectFile, "bad-prop-name3", messages );
- }
-
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/antlib/core/test/PropertyTestType.java b/proposal/myrmidon/src/testcases/org/apache/antlib/core/test/PropertyTestType.java
deleted file mode 100644
index c146a77df..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/antlib/core/test/PropertyTestType.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.antlib.core.test;
-
-import org.apache.myrmidon.framework.DataType;
-
-/**
- * A test data-type used by the property tests.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- *
- * @ant:data-type name="property-test-type"
- */
-public class PropertyTestType
- implements DataType
-{
- private String m_value;
-
- public void setValue( final String value )
- {
- m_value = value;
- }
-
- /**
- * Used in the test project file to check the value has been set.
- */
- public String toString()
- {
- return "value=[" + m_value + "]";
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/antlib/core/test/if.ant b/proposal/myrmidon/src/testcases/org/apache/antlib/core/test/if.ant
deleted file mode 100644
index b3caca2af..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/antlib/core/test/if.ant
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
- test-prop is set
-
-
- test-prop is not set
-
-
-
-
-
-
- test-prop is set
-
-
- test-prop is not set
-
-
-
-
-
- test-prop is set
-
-
- test-prop is not set
-
-
-
-
-
-
- test-prop is set
-
-
- test-prop is not set
-
-
-
-
-
-
- task 1
- task 2
- task 3
- task 4
-
-
-
-
-
- no go
-
-
-
-
-
- no go
-
-
-
-
\ No newline at end of file
diff --git a/proposal/myrmidon/src/testcases/org/apache/antlib/core/test/property.ant b/proposal/myrmidon/src/testcases/org/apache/antlib/core/test/property.ant
deleted file mode 100644
index 03cad74a0..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/antlib/core/test/property.ant
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
- test-prop = [${test-prop}]
-
-
-
-
- some value
- test-prop2 = [${test-prop2}]
-
-
-
-
-
-
-
- test-prop3 = [${test-prop3}]
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- another value
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/proposal/myrmidon/src/testcases/org/apache/antlib/vfile/test/CopyFilesTaskTestCase.java b/proposal/myrmidon/src/testcases/org/apache/antlib/vfile/test/CopyFilesTaskTestCase.java
deleted file mode 100644
index ad84a0219..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/antlib/vfile/test/CopyFilesTaskTestCase.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.antlib.vfile.test;
-
-import java.io.File;
-import org.apache.myrmidon.AbstractProjectTest;
-
-/**
- * Test cases for the task.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class CopyFilesTaskTestCase
- extends AbstractProjectTest
-{
- public CopyFilesTaskTestCase( String name )
- {
- super( name );
- }
-
- /**
- * A simple smoke test.
- */
- public void testCopy() throws Exception
- {
- final File projectFile = getTestResource( "copy.ant" );
- executeTarget( projectFile, "copy" );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/antlib/vfile/test/copy.ant b/proposal/myrmidon/src/testcases/org/apache/antlib/vfile/test/copy.ant
deleted file mode 100644
index 18ea5067c..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/antlib/vfile/test/copy.ant
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/proposal/myrmidon/src/testcases/org/apache/antlib/vfile/test/src/emptyFile.txt b/proposal/myrmidon/src/testcases/org/apache/antlib/vfile/test/src/emptyFile.txt
deleted file mode 100644
index e69de29bb..000000000
diff --git a/proposal/myrmidon/src/testcases/org/apache/antlib/vfile/test/src/file1.txt b/proposal/myrmidon/src/testcases/org/apache/antlib/vfile/test/src/file1.txt
deleted file mode 100644
index 9ad7b1b57..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/antlib/vfile/test/src/file1.txt
+++ /dev/null
@@ -1 +0,0 @@
-A test file.
\ No newline at end of file
diff --git a/proposal/myrmidon/src/testcases/org/apache/antlib/vfile/test/src/subdir1/someFile.html b/proposal/myrmidon/src/testcases/org/apache/antlib/vfile/test/src/subdir1/someFile.html
deleted file mode 100644
index c769030c0..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/antlib/vfile/test/src/subdir1/someFile.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-Yo!
-
-
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/bzip2/asf-logo-huge.tar b/proposal/myrmidon/src/testcases/org/apache/aut/bzip2/asf-logo-huge.tar
deleted file mode 100644
index 3f9260978..000000000
Binary files a/proposal/myrmidon/src/testcases/org/apache/aut/bzip2/asf-logo-huge.tar and /dev/null differ
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/bzip2/asf-logo-huge.tar.bz2 b/proposal/myrmidon/src/testcases/org/apache/aut/bzip2/asf-logo-huge.tar.bz2
deleted file mode 100644
index 7c2d2154a..000000000
Binary files a/proposal/myrmidon/src/testcases/org/apache/aut/bzip2/asf-logo-huge.tar.bz2 and /dev/null differ
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/bzip2/test/BzipTestCase.java b/proposal/myrmidon/src/testcases/org/apache/aut/bzip2/test/BzipTestCase.java
deleted file mode 100644
index 2bd65da42..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/aut/bzip2/test/BzipTestCase.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.aut.bzip2.test;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import junit.framework.TestCase;
-import org.apache.avalon.excalibur.io.FileUtil;
-import org.apache.avalon.excalibur.io.IOUtil;
-import org.apache.aut.bzip2.CBZip2OutputStream;
-import org.apache.aut.bzip2.CBZip2InputStream;
-
-/**
- * A test the stress tested the BZip implementation to verify
- * that it behaves correctly.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class BzipTestCase
- extends TestCase
-{
- private final static byte[] HEADER = new byte[]{(byte)'B', (byte)'Z'};
-
- public BzipTestCase( final String name )
- {
- super( name );
- }
-
- public void testBzipOutputStream()
- throws Exception
- {
- final InputStream input = getInputStream( "asf-logo-huge.tar" );
- final File outputFile = getOutputFile( ".tar.bz2" );
- final OutputStream output = new FileOutputStream( outputFile );
- final CBZip2OutputStream packedOutput = getPackedOutput( output );
- IOUtil.copy( input, packedOutput );
- IOUtil.shutdownStream( input );
- IOUtil.shutdownStream( packedOutput );
- IOUtil.shutdownStream( output );
- compareContents( "asf-logo-huge.tar.bz2", outputFile );
- FileUtil.forceDelete( outputFile );
- }
-
- public void testBzipInputStream()
- throws Exception
- {
- final InputStream input = getInputStream( "asf-logo-huge.tar.bz2" );
- final File outputFile = getOutputFile( ".tar" );
- final OutputStream output = new FileOutputStream( outputFile );
- final CBZip2InputStream packedInput = getPackedInput( input );
- IOUtil.copy( packedInput, output );
- IOUtil.shutdownStream( input );
- IOUtil.shutdownStream( packedInput );
- IOUtil.shutdownStream( output );
- compareContents( "asf-logo-huge.tar", outputFile );
- FileUtil.forceDelete( outputFile );
- }
-
- private void compareContents( final String initial, final File generated )
- throws Exception
- {
- final InputStream input1 = getInputStream( initial );
- final InputStream input2 = new FileInputStream( generated );
- final boolean test = IOUtil.contentEquals( input1, input2 );
- IOUtil.shutdownStream( input1 );
- IOUtil.shutdownStream( input2 );
- assertTrue( "Contents of " + initial + " matches generated version " + generated, test );
- }
-
- private CBZip2InputStream getPackedInput( final InputStream input )
- throws IOException
- {
- final int b1 = input.read();
- final int b2 = input.read();
- assertEquals( "Equal header byte1", b1, 'B' );
- assertEquals( "Equal header byte2", b2, 'Z' );
- return new CBZip2InputStream( input );
- }
-
- private CBZip2OutputStream getPackedOutput( final OutputStream output )
- throws IOException
- {
- output.write( HEADER );
- return new CBZip2OutputStream( output );
- }
-
- private File getOutputFile( final String postfix )
- throws IOException
- {
- final File cwd = new File( "." );
- return File.createTempFile( "ant-test", postfix, cwd );
- }
-
- private InputStream getInputStream( final String resource )
- throws Exception
- {
- final String filename = "src" + File.separator + "testcases" + File.separator +
- getClass().getName().replace( '.', File.separatorChar );
- final String path = FileUtil.getPath( filename );
- final File input = new File( path, resource );
- return new FileInputStream( input );
- //final ClassLoader loader = getClass().getClassLoader();
- //return loader.getResourceAsStream( resource );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/bzip2/test/asf-logo-huge.tar b/proposal/myrmidon/src/testcases/org/apache/aut/bzip2/test/asf-logo-huge.tar
deleted file mode 100644
index 3f9260978..000000000
Binary files a/proposal/myrmidon/src/testcases/org/apache/aut/bzip2/test/asf-logo-huge.tar and /dev/null differ
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/bzip2/test/asf-logo-huge.tar.bz2 b/proposal/myrmidon/src/testcases/org/apache/aut/bzip2/test/asf-logo-huge.tar.bz2
deleted file mode 100644
index 7c2d2154a..000000000
Binary files a/proposal/myrmidon/src/testcases/org/apache/aut/bzip2/test/asf-logo-huge.tar.bz2 and /dev/null differ
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/AbstractFileSystemTestCase.java b/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/AbstractFileSystemTestCase.java
deleted file mode 100644
index 61dc091ff..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/AbstractFileSystemTestCase.java
+++ /dev/null
@@ -1,795 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.aut.vfs.test;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.aut.vfs.impl.DefaultFileSystemManager;
-import org.apache.aut.vfs.provider.AbstractFileObject;
-import org.apache.aut.vfs.FileObject;
-import org.apache.aut.vfs.FileType;
-import org.apache.aut.vfs.FileSystemException;
-import org.apache.aut.vfs.FileName;
-import org.apache.aut.vfs.NameScope;
-import org.apache.aut.vfs.FileContent;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.AbstractMyrmidonTest;
-
-/**
- * File system test cases, which verifies the structure and naming
- * functionality.
- *
- * Works from a base folder, and assumes a particular structure under
- * that base folder.
- *
- * @author Adam Murdoch
- */
-public abstract class AbstractFileSystemTestCase
- extends AbstractMyrmidonTest
-{
- private final static Resources REZ
- = ResourceManager.getPackageResources( AbstractFileObject.class );
-
- protected FileObject m_baseFolder;
- protected DefaultFileSystemManager m_manager;
-
- // Contents of "file1.txt"
- private String m_charContent;
-
- public AbstractFileSystemTestCase( String name )
- {
- super( name );
- }
-
- /**
- * Builds the expected folder structure.
- */
- private FileInfo buildExpectedStructure()
- {
- // Build the expected structure
- final FileInfo base = new FileInfo( "test", FileType.FOLDER );
- base.addChild( new FileInfo( "file1.txt", FileType.FILE ) );
- base.addChild( new FileInfo( "empty.txt", FileType.FILE ) );
- base.addChild( new FileInfo( "emptydir", FileType.FOLDER ) );
-
- final FileInfo dir = new FileInfo( "dir1", FileType.FOLDER );
- base.addChild( dir );
- dir.addChild( new FileInfo( "file1.txt", FileType.FILE ) );
- dir.addChild( new FileInfo( "file2.txt", FileType.FILE ) );
- dir.addChild( new FileInfo( "file3.txt", FileType.FILE ) );
- return base;
- }
-
- /**
- * Returns the base folder to run the tests against.
- */
- protected abstract FileObject getBaseFolder() throws Exception;
-
- /**
- * Sets up the test
- */
- protected void setUp() throws Exception
- {
- // Create the file system manager
- m_manager = new DefaultFileSystemManager();
-
- // Locate the base folder
- m_baseFolder = getBaseFolder();
-
- // Make some assumptions absout the name
- assertTrue( ! m_baseFolder.getName().getPath().equals( "/" ) );
-
- // Build the expected content of "file1.txt"
- final String eol = System.getProperty( "line.separator" );
- m_charContent = "This is a test file." + eol + "With 2 lines in it." + eol;
- }
-
- /**
- * Cleans-up test.
- */
- protected void tearDown() throws Exception
- {
- m_manager.close();
- }
-
- /**
- * Tests resolution of absolute URI.
- */
- public void testAbsoluteURI() throws Exception
- {
- // Try fetching base folder again by its URI
- final String uri = m_baseFolder.getName().getURI();
- final FileObject file = m_manager.resolveFile( uri );
-
- assertSame( "file object", m_baseFolder, file );
- }
-
- /**
- * Tests resolution of relative file names via the FS manager
- */
- public void testRelativeURI() throws Exception
- {
- // Build base dir
- m_manager.setBaseFile( m_baseFolder );
-
- // Locate the base dir
- FileObject file = m_manager.resolveFile( "." );
- assertSame( "file object", m_baseFolder, file );
-
- // Locate a child
- file = m_manager.resolveFile( "some-child" );
- assertSame( "file object", m_baseFolder, file.getParent() );
-
- // Locate a descendent
- file = m_manager.resolveFile( "some-folder/some-file" );
- assertSame( "file object", m_baseFolder, file.getParent().getParent() );
-
- // Locate parent
- file = m_manager.resolveFile( ".." );
- assertSame( "file object", m_baseFolder.getParent(), file );
- }
-
- /**
- * Tests encoding of relative URI.
- */
- public void testRelativeUriEncoding() throws Exception
- {
- // Build base dir
- m_manager.setBaseFile( m_baseFolder );
- final String path = m_baseFolder.getName().getPath();
-
- // Encode "some file"
- FileObject file = m_manager.resolveFile( "%73%6f%6d%65%20%66%69%6c%65" );
- assertEquals( path + "/some file", file.getName().getPath() );
-
- // Encode "."
- file = m_manager.resolveFile( "%2e" );
- assertEquals( path, file.getName().getPath() );
-
- // Encode '%'
- file = m_manager.resolveFile( "a%25" );
- assertEquals( path + "/a%", file.getName().getPath() );
-
- // Encode /
- file = m_manager.resolveFile( "dir%2fchild" );
- assertEquals( path + "/dir/child", file.getName().getPath() );
-
- // Encode \
- file = m_manager.resolveFile( "dir%5cchild" );
- assertEquals( path + "/dir/child", file.getName().getPath() );
-
- // Use "%" literal
- try
- {
- m_manager.resolveFile( "%" );
- fail();
- }
- catch( FileSystemException e )
- {
- }
-
- // Not enough digits in encoded char
- try
- {
- m_manager.resolveFile( "%5" );
- fail();
- }
- catch( FileSystemException e )
- {
- }
-
- // Invalid digit in encoded char
- try
- {
- m_manager.resolveFile( "%q" );
- fail();
- }
- catch( FileSystemException e )
- {
- }
- }
-
- /**
- * Tests the root file name.
- */
- public void testRootFileName() throws Exception
- {
- // Locate the root file
- final FileName rootName = m_baseFolder.getRoot().getName();
-
- // Test that the root path is "/"
- assertEquals( "root path", "/", rootName.getPath() );
-
- // Test that the root basname is ""
- assertEquals( "root base name", "", rootName.getBaseName() );
-
- // Test that the root name has no parent
- assertNull( "root parent", rootName.getParent() );
- }
-
- /**
- * Tests child file names.
- */
- public void testChildName() throws Exception
- {
- final FileName baseName = m_baseFolder.getName();
- final String basePath = baseName.getPath();
- final FileName name = baseName.resolveName( "some-child", NameScope.CHILD );
-
- // Test path is absolute
- assertTrue( "is absolute", basePath.startsWith( "/" ) );
-
- // Test base name
- assertEquals( "base name", "some-child", name.getBaseName() );
-
- // Test absolute path
- assertEquals( "absolute path", basePath + "/some-child", name.getPath() );
-
- // Test parent path
- assertEquals( "parent absolute path", basePath, name.getParent().getPath() );
-
- // Try using a compound name to find a child
- assertBadName( name, "a/b", NameScope.CHILD );
-
- // Check other invalid names
- checkDescendentNames( name, NameScope.CHILD );
- }
-
- /**
- * Name resolution tests that are common for CHILD or DESCENDENT scope.
- */
- private void checkDescendentNames( final FileName name,
- final NameScope scope )
- throws Exception
- {
- // Make some assumptions about the name
- assertTrue( !name.getPath().equals( "/" ) );
- assertTrue( !name.getPath().endsWith( "/a" ) );
- assertTrue( !name.getPath().endsWith( "/a/b" ) );
-
- // Test names with the same prefix
- String path = name.getPath() + "/a";
- assertSameName( path, name, path, scope );
- assertSameName( path, name, "../" + name.getBaseName() + "/a", scope );
-
- // Test an empty name
- assertBadName( name, "", scope );
-
- // Test . name
- assertBadName( name, ".", scope );
- assertBadName( name, "./", scope );
-
- // Test ancestor names
- assertBadName( name, "..", scope );
- assertBadName( name, "../a", scope );
- assertBadName( name, "../" + name.getBaseName() + "a", scope );
- assertBadName( name, "a/..", scope );
-
- // Test absolute names
- assertBadName( name, "/", scope );
- assertBadName( name, "/a", scope );
- assertBadName( name, "/a/b", scope );
- assertBadName( name, name.getPath(), scope );
- assertBadName( name, name.getPath() + "a", scope );
- }
-
- /**
- * Checks that a relative name resolves to the expected absolute path.
- * Tests both forward and back slashes.
- */
- private void assertSameName( final String expectedPath,
- final FileName baseName,
- final String relName,
- final NameScope scope )
- throws Exception
- {
- // Try the supplied name
- FileName name = baseName.resolveName( relName, scope );
- assertEquals( expectedPath, name.getPath() );
-
- // Replace the separators
- relName.replace( '\\', '/' );
- name = baseName.resolveName( relName, scope );
- assertEquals( expectedPath, name.getPath() );
-
- // And again
- relName.replace( '/', '\\' );
- name = baseName.resolveName( relName, scope );
- assertEquals( expectedPath, name.getPath() );
- }
-
- /**
- * Checks that a relative name resolves to the expected absolute path.
- * Tests both forward and back slashes.
- */
- private void assertSameName( String expectedPath,
- FileName baseName,
- String relName ) throws Exception
- {
- assertSameName( expectedPath, baseName, relName, NameScope.FILE_SYSTEM );
- }
-
- /**
- * Tests relative name resolution, relative to the base folder.
- */
- public void testNameResolution() throws Exception
- {
- final FileName baseName = m_baseFolder.getName();
- final String parentPath = baseName.getParent().getPath();
- final String path = baseName.getPath();
- final String childPath = path + "/some-child";
-
- // Test empty relative path
- assertSameName( path, baseName, "" );
-
- // Test . relative path
- assertSameName( path, baseName, "." );
-
- // Test ./ relative path
- assertSameName( path, baseName, "./" );
-
- // Test .// relative path
- assertSameName( path, baseName, ".//" );
-
- // Test .///.///. relative path
- assertSameName( path, baseName, ".///.///." );
- assertSameName( path, baseName, "./\\/.\\//." );
-
- // Test /.. relative path
- assertSameName( path, baseName, "a/.." );
-
- // Test .. relative path
- assertSameName( parentPath, baseName, ".." );
-
- // Test ../ relative path
- assertSameName( parentPath, baseName, "../" );
-
- // Test ..//./ relative path
- assertSameName( parentPath, baseName, "..//./" );
- assertSameName( parentPath, baseName, "..//.\\" );
-
- // Test /../.. relative path
- assertSameName( parentPath, baseName, "a/../.." );
-
- // Test relative path
- assertSameName( childPath, baseName, "some-child" );
-
- // Test ./ relative path
- assertSameName( childPath, baseName, "./some-child" );
-
- // Test .// relative path
- assertSameName( childPath, baseName, "./some-child/" );
-
- // Test /././././ relative path
- assertSameName( childPath, baseName, "./some-child/././././" );
-
- // Test /../ relative path
- assertSameName( childPath, baseName, "a/../some-child" );
-
- // Test //../../ relative path
- assertSameName( childPath, baseName, "a/b/../../some-child" );
- }
-
- /**
- * Tests descendent name resolution.
- */
- public void testDescendentName()
- throws Exception
- {
- final FileName baseName = m_baseFolder.getName();
-
- // Test direct child
- String path = baseName.getPath() + "/some-child";
- assertSameName( path, baseName, "some-child", NameScope.DESCENDENT );
-
- // Test compound name
- path = path + "/grand-child";
- assertSameName( path, baseName, "some-child/grand-child", NameScope.DESCENDENT );
-
- // Test relative names
- assertSameName( path, baseName, "./some-child/grand-child", NameScope.DESCENDENT );
- assertSameName( path, baseName, "./nada/../some-child/grand-child", NameScope.DESCENDENT );
- assertSameName( path, baseName, "some-child/./grand-child", NameScope.DESCENDENT );
-
- // Test badly formed descendent names
- checkDescendentNames( baseName, NameScope.DESCENDENT );
- }
-
- /**
- * Tests resolution of absolute names.
- */
- public void testAbsoluteNames() throws Exception
- {
- // Test against the base folder
- FileName name = m_baseFolder.getName();
- checkAbsoluteNames( name );
-
- // Test against the root
- name = m_baseFolder.getRoot().getName();
- checkAbsoluteNames( name );
-
- // Test against some unknown file
- name = name.resolveName( "a/b/unknown" );
- checkAbsoluteNames( name );
- }
-
- /**
- * Tests resolution of absolute names.
- */
- private void checkAbsoluteNames( final FileName name ) throws Exception
- {
- // Root
- assertSameName( "/", name, "/" );
- assertSameName( "/", name, "//" );
- assertSameName( "/", name, "/." );
- assertSameName( "/", name, "/some file/.." );
-
- // Some absolute names
- assertSameName( "/a", name, "/a" );
- assertSameName( "/a", name, "/./a" );
- assertSameName( "/a", name, "/a/." );
- assertSameName( "/a/b", name, "/a/b" );
-
- // Some bad names
- assertBadName( name, "/..", NameScope.FILE_SYSTEM );
- assertBadName( name, "/a/../..", NameScope.FILE_SYSTEM );
- }
-
- /**
- * Asserts that a particular relative name is invalid for a particular
- * scope.
- */
- private void assertBadName( final FileName name,
- final String relName,
- final NameScope scope )
- {
- try
- {
- name.resolveName( relName, scope );
- fail( "expected failure" );
- }
- catch( FileSystemException e )
- {
- // TODO - should check error message
- }
- }
-
- /**
- * Walks the base folder structure, asserting it contains exactly the
- * expected files and folders.
- */
- public void testStructure() throws Exception
- {
- final FileInfo baseInfo = buildExpectedStructure();
- assertSameStructure( m_baseFolder, baseInfo );
- }
-
- /**
- * Walks a folder structure, asserting it contains exactly the
- * expected files and folders.
- */
- protected void assertSameStructure( final FileObject folder,
- final FileInfo expected )
- throws Exception
- {
- // Setup the structure
- final List queueExpected = new ArrayList();
- queueExpected.add( expected );
-
- final List queueActual = new ArrayList();
- queueActual.add( folder );
-
- while( queueActual.size() > 0 )
- {
- final FileObject file = (FileObject)queueActual.remove( 0 );
- final FileInfo info = (FileInfo)queueExpected.remove( 0 );
-
- // Check the type is correct
- assertSame( file.getType(), info._type );
-
- if( info._type == FileType.FILE )
- {
- continue;
- }
-
- // Check children
- final FileObject[] children = file.getChildren();
-
- // Make sure all children were found
- assertNotNull( children );
- assertEquals( "count children of \"" + file.getName() + "\"", info._children.size(), children.length );
-
- // Recursively check each child
- for( int i = 0; i < children.length; i++ )
- {
- final FileObject child = children[ i ];
- final FileInfo childInfo = (FileInfo)info._children.get( child.getName().getBaseName() );
-
- // Make sure the child is expected
- assertNotNull( childInfo );
-
- // Add to the queue of files to check
- queueExpected.add( childInfo );
- queueActual.add( child );
- }
- }
- }
-
- /**
- * Tests existence determination.
- */
- public void testExists() throws Exception
- {
- // Test a file
- FileObject file = m_baseFolder.resolveFile( "file1.txt" );
- assertTrue( "file exists", file.exists() );
-
- // Test a folder
- file = m_baseFolder.resolveFile( "dir1" );
- assertTrue( "folder exists", file.exists() );
-
- // Test an unknown file
- file = m_baseFolder.resolveFile( "unknown-child" );
- assertTrue( "unknown file does not exist", !file.exists() );
-
- // Test an unknown file in an unknown folder
- file = m_baseFolder.resolveFile( "unknown-folder/unknown-child" );
- assertTrue( "unknown file does not exist", !file.exists() );
- }
-
- /**
- * Tests type determination.
- */
- public void testType() throws Exception
- {
- // Test a file
- FileObject file = m_baseFolder.resolveFile( "file1.txt" );
- assertSame( FileType.FILE, file.getType() );
-
- // Test a folder
- file = m_baseFolder.resolveFile( "dir1" );
- assertSame( FileType.FOLDER, file.getType() );
-
- // Test an unknown file
- file = m_baseFolder.resolveFile( "unknown-child" );
- try
- {
- file.getType();
- fail();
- }
- catch( FileSystemException e )
- {
- final String message = REZ.getString( "get-type-no-exist.error", file );
- assertSameMessage( message, e );
- }
- }
-
- /**
- * Tests parent identity
- */
- public void testParent() throws FileSystemException
- {
- // Test when both exist
- FileObject folder = m_baseFolder.resolveFile( "dir1" );
- FileObject child = folder.resolveFile( "file3.txt" );
- assertTrue( "folder exists", folder.exists() );
- assertTrue( "child exists", child.exists() );
- assertSame( folder, child.getParent() );
-
- // Test when file does not exist
- child = folder.resolveFile( "unknown-file" );
- assertTrue( "folder exists", folder.exists() );
- assertTrue( "child does not exist", !child.exists() );
- assertSame( folder, child.getParent() );
-
- // Test when neither exists
- folder = m_baseFolder.resolveFile( "unknown-folder" );
- child = folder.resolveFile( "unknown-file" );
- assertTrue( "folder does not exist", !folder.exists() );
- assertTrue( "child does not exist", !child.exists() );
- assertSame( folder, child.getParent() );
-
- // Test root of the file system has no parent
- FileObject root = m_baseFolder.getRoot();
- assertNull( "root has null parent", root.getParent() );
- }
-
- /**
- * Tests that children cannot be listed for non-folders.
- */
- public void testChildren() throws FileSystemException
- {
- // Check for file
- FileObject file = m_baseFolder.resolveFile( "file1.txt" );
- assertSame( FileType.FILE, file.getType() );
- try
- {
- file.getChildren();
- fail();
- }
- catch( FileSystemException e )
- {
- final String message = REZ.getString( "list-children-not-folder.error", file );
- assertSameMessage( message, e );
- }
-
- // Should be able to get child by name
- file = file.resolveFile( "some-child" );
- assertNotNull( file );
-
- // Check for unknown file
- file = m_baseFolder.resolveFile( "unknown-file" );
- assertTrue( !file.exists() );
- try
- {
- file.getChildren();
- fail();
- }
- catch( FileSystemException e )
- {
- final String message = REZ.getString( "list-children-no-exist.error", file );
- assertSameMessage( message, e );
- }
-
- // Should be able to get child by name
- FileObject child = file.resolveFile( "some-child" );
- assertNotNull( child );
- }
-
- /**
- * Tests content.
- */
- public void testContent() throws Exception
- {
- // Test non-empty file
- FileObject file = m_baseFolder.resolveFile( "file1.txt" );
- FileContent content = file.getContent();
- assertSameContent( m_charContent, content );
-
- // Test empty file
- file = m_baseFolder.resolveFile( "empty.txt" );
- content = file.getContent();
- assertSameContent( "", content );
- }
-
- /**
- * Asserts that the content of a file is the same as expected. Checks the
- * length reported by getSize() is correct, then reads the content as
- * a byte stream, and as a char stream, and compares the result with
- * the expected content. Assumes files are encoded using UTF-8.
- */
- protected void assertSameContent( final String expected,
- final FileContent content )
- throws Exception
- {
- // Get file content as a binary stream
- final byte[] expectedBin = expected.getBytes( "utf-8" );
-
- // Check lengths
- assertEquals( "same content length", expectedBin.length, content.getSize() );
-
- // Read content into byte array
- final InputStream instr = content.getInputStream();
- final ByteArrayOutputStream outstr;
- try
- {
- outstr = new ByteArrayOutputStream();
- final byte[] buffer = new byte[ 256 ];
- int nread = 0;
- while( nread >= 0 )
- {
- outstr.write( buffer, 0, nread );
- nread = instr.read( buffer );
- }
- }
- finally
- {
- instr.close();
- }
-
- // Compare
- assertTrue( "same binary content", Arrays.equals( expectedBin, outstr.toByteArray() ) );
- }
-
- /**
- * Tests that folders and unknown files have no content.
- */
- public void testNoContent() throws Exception
- {
- // Try getting the content of a folder
- FileObject folder = m_baseFolder.resolveFile( "dir1" );
- try
- {
- folder.getContent();
- fail();
- }
- catch( FileSystemException e )
- {
- final String message = REZ.getString( "get-folder-content.error", folder );
- assertSameMessage( message, e );
- }
-
- // Try getting the content of an unknown file
- FileObject unknownFile = m_baseFolder.resolveFile( "unknown-file" );
- FileContent content = unknownFile.getContent();
- try
- {
- content.getInputStream();
- fail();
- }
- catch( FileSystemException e )
- {
- final String message = REZ.getString( "read-no-exist.error", unknownFile );
- assertSameMessage( message, e );
- }
- try
- {
- content.getSize();
- fail();
- }
- catch( FileSystemException e )
- {
- final String message = REZ.getString( "get-size-no-exist.error", unknownFile );
- assertSameMessage( message, e );
- }
- }
-
- /**
- * Tests that content and file objects are usable after being closed.
- */
- public void testReuse() throws Exception
- {
- // Get the test file
- FileObject file = m_baseFolder.resolveFile( "file1.txt" );
- assertEquals( FileType.FILE, file.getType() );
-
- // Get the file content
- FileContent content = file.getContent();
- assertSameContent( m_charContent, content );
-
- // Read the content again
- content = file.getContent();
- assertSameContent( m_charContent, content );
-
- // Close the content + file
- content.close();
- file.close();
-
- // Read the content again
- content = file.getContent();
- assertSameContent( m_charContent, content );
- }
-
- /**
- * Info about a file.
- */
- protected static final class FileInfo
- {
- String _baseName;
- FileType _type;
- Map _children = new HashMap();
-
- public FileInfo( String name, FileType type )
- {
- _baseName = name;
- _type = type;
- }
-
- /** Adds a child. */
- public void addChild( FileInfo child )
- {
- _children.put( child._baseName, child );
- }
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/AbstractReadOnlyFileSystemTestCase.java b/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/AbstractReadOnlyFileSystemTestCase.java
deleted file mode 100644
index b415a6565..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/AbstractReadOnlyFileSystemTestCase.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.aut.vfs.test;
-
-import org.apache.aut.vfs.test.AbstractFileSystemTestCase;
-
-/**
- * File system tests which check that a read-only file system cannot be
- * changed.
- *
- * @author Adam Murdoch
- */
-public abstract class AbstractReadOnlyFileSystemTestCase extends AbstractFileSystemTestCase
-{
- public AbstractReadOnlyFileSystemTestCase( String name )
- {
- super( name );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/AbstractWritableFileSystemTestCase.java b/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/AbstractWritableFileSystemTestCase.java
deleted file mode 100644
index 06a73c132..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/AbstractWritableFileSystemTestCase.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.aut.vfs.test;
-
-import java.io.OutputStream;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.aut.vfs.test.AbstractFileSystemTestCase;
-import org.apache.aut.vfs.FileObject;
-import org.apache.aut.vfs.FileType;
-import org.apache.aut.vfs.FileSystemException;
-
-/**
- * File system test that check that a file system can be modified.
- *
- * @author Adam Murdoch
- */
-public abstract class AbstractWritableFileSystemTestCase
- extends AbstractFileSystemTestCase
-{
- public AbstractWritableFileSystemTestCase( String name )
- {
- super( name );
- }
-
- /**
- * Returns the URI for the area to do tests in.
- */
- protected abstract FileObject getWriteFolder() throws Exception;
-
- /**
- * Sets up a scratch folder for the test to use.
- */
- protected FileObject createScratchFolder() throws Exception
- {
- FileObject scratchFolder = getWriteFolder();
-
- // Make sure the test folder is empty
- scratchFolder.delete();
- scratchFolder.create( FileType.FOLDER );
-
- return scratchFolder;
- }
-
- /**
- * Tests folder creation.
- */
- public void testFolderCreate() throws Exception
- {
- FileObject scratchFolder = createScratchFolder();
-
- // Create direct child of the test folder
- FileObject folder = scratchFolder.resolveFile( "dir1" );
- assertTrue( !folder.exists() );
- folder.create( FileType.FOLDER );
- assertTrue( folder.exists() );
- assertEquals( 0, folder.getChildren().length );
-
- // Create a descendant, where the intermediate folders don't exist
- folder = scratchFolder.resolveFile( "dir2/dir1/dir1" );
- assertTrue( !folder.exists() );
- assertTrue( !folder.getParent().exists() );
- assertTrue( !folder.getParent().getParent().exists() );
- folder.create( FileType.FOLDER );
- assertTrue( folder.exists() );
- assertEquals( 0, folder.getChildren().length );
- assertTrue( folder.getParent().exists() );
- assertTrue( folder.getParent().getParent().exists() );
-
- // Test creating a folder that already exists
- folder.create( FileType.FOLDER );
- }
-
- /**
- * Tests file creation
- */
- public void testFileCreate() throws Exception
- {
- FileObject scratchFolder = createScratchFolder();
-
- // Create direct child of the test folder
- FileObject file = scratchFolder.resolveFile( "file1.txt" );
- assertTrue( !file.exists() );
- file.create( FileType.FILE );
- assertTrue( file.exists() );
- assertEquals( 0, file.getContent().getSize() );
-
- // Create a descendant, where the intermediate folders don't exist
- file = scratchFolder.resolveFile( "dir1/dir1/file1.txt" );
- assertTrue( !file.exists() );
- assertTrue( !file.getParent().exists() );
- assertTrue( !file.getParent().getParent().exists() );
- file.create( FileType.FILE );
- assertTrue( file.exists() );
- assertEquals( 0, file.getContent().getSize() );
- assertTrue( file.getParent().exists() );
- assertTrue( file.getParent().getParent().exists() );
-
- // Test creating a file that already exists
- file.create( FileType.FILE );
- }
-
- /**
- * Tests file/folder creation with mismatched types.
- */
- public void testFileCreateMismatched() throws Exception
- {
- FileObject scratchFolder = createScratchFolder();
-
- // Create a test file and folder
- FileObject file = scratchFolder.resolveFile( "dir1/file1.txt" );
- file.create( FileType.FILE );
- assertEquals( FileType.FILE, file.getType() );
-
- FileObject folder = scratchFolder.resolveFile( "dir1/dir2" );
- folder.create( FileType.FOLDER );
- assertEquals( FileType.FOLDER, folder.getType() );
-
- // Attempt to create a file that already exists as a folder
- try
- {
- folder.create( FileType.FILE );
- assertTrue( false );
- }
- catch( FileSystemException exc )
- {
- }
-
- // Attempt to create a folder that already exists as a file
- try
- {
- file.create( FileType.FOLDER );
- assertTrue( false );
- }
- catch( FileSystemException exc )
- {
- }
-
- // Attempt to create a folder as a child of a file
- FileObject folder2 = file.resolveFile( "some-child" );
- try
- {
- folder2.create( FileType.FOLDER );
- assertTrue( false );
- }
- catch( FileSystemException exc )
- {
- }
- }
-
- /**
- * Tests deletion
- */
- public void testDelete() throws Exception
- {
- // Set-up the test structure
- FileObject folder = createScratchFolder();
- folder.resolveFile( "file1.txt" ).create( FileType.FILE );
- folder.resolveFile( "emptydir" ).create( FileType.FOLDER );
- folder.resolveFile( "dir1/file1.txt" ).create( FileType.FILE );
- folder.resolveFile( "dir1/dir2/file2.txt" ).create( FileType.FILE );
-
- // Delete a file
- FileObject file = folder.resolveFile( "file1.txt" );
- assertTrue( file.exists() );
- file.delete();
- assertTrue( !file.exists() );
-
- // Delete an empty folder
- file = folder.resolveFile( "emptydir" );
- assertTrue( file.exists() );
- file.delete();
- assertTrue( !file.exists() );
-
- // Recursive delete
- file = folder.resolveFile( "dir1" );
- FileObject file2 = file.resolveFile( "dir2/file2.txt" );
- assertTrue( file.exists() );
- assertTrue( file2.exists() );
- file.delete();
- assertTrue( !file.exists() );
- assertTrue( !file2.exists() );
-
- // Delete a file that does not exist
- file = folder.resolveFile( "some-folder/some-file" );
- assertTrue( !file.exists() );
- file.delete();
- assertTrue( !file.exists() );
- }
-
- /**
- * Test that children are handled correctly by create and delete.
- */
- public void testListChildren() throws Exception
- {
- FileObject folder = createScratchFolder();
- HashSet names = new HashSet();
-
- // Make sure the folder is empty
- assertEquals( 0, folder.getChildren().length );
-
- // Create a child folder
- folder.resolveFile( "dir1" ).create( FileType.FOLDER );
- names.add( "dir1" );
- assertSameFileSet( names, folder.getChildren() );
-
- // Create a child file
- folder.resolveFile( "file1.html" ).create( FileType.FILE );
- names.add( "file1.html" );
- assertSameFileSet( names, folder.getChildren() );
-
- // Create a descendent
- folder.resolveFile( "dir2/file1.txt" ).create( FileType.FILE );
- names.add( "dir2" );
- assertSameFileSet( names, folder.getChildren() );
-
- // Create a child file via an output stream
- OutputStream outstr = folder.resolveFile( "file2.txt" ).getContent().getOutputStream();
- outstr.close();
- names.add( "file2.txt" );
- assertSameFileSet( names, folder.getChildren() );
-
- // Delete a child folder
- folder.resolveFile( "dir1" ).delete();
- names.remove( "dir1" );
- assertSameFileSet( names, folder.getChildren() );
-
- // Delete a child file
- folder.resolveFile( "file1.html" ).delete();
- names.remove( "file1.html" );
- assertSameFileSet( names, folder.getChildren() );
-
- // Recreate the folder
- folder.delete();
- folder.create( FileType.FOLDER );
- assertEquals( 0, folder.getChildren().length );
- }
-
- /**
- * Ensures the names of a set of files match an expected set.
- */
- private void assertSameFileSet( Set names, FileObject[] files )
- {
- // Make sure the sets are the same length
- assertEquals( names.size(), files.length );
-
- // Check for unexpected names
- for( int i = 0; i < files.length; i++ )
- {
- FileObject file = files[ i ];
- assertTrue( names.contains( file.getName().getBaseName() ) );
- }
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/FtpFileSystemTestCase.java b/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/FtpFileSystemTestCase.java
deleted file mode 100644
index 0788c6eed..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/FtpFileSystemTestCase.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.aut.vfs.test;
-
-import org.apache.aut.vfs.provider.ftp.FtpFileSystemProvider;
-import org.apache.aut.vfs.test.AbstractWritableFileSystemTestCase;
-import org.apache.aut.vfs.FileObject;
-
-/**
- * Tests for FTP file systems.
- *
- * @author Adam Murdoch
- */
-public class FtpFileSystemTestCase
- extends AbstractWritableFileSystemTestCase
-{
- public FtpFileSystemTestCase( String name )
- {
- super( name );
- }
-
- /**
- * Returns the URI for the base folder.
- */
- protected FileObject getBaseFolder() throws Exception
- {
- final String uri = System.getProperty( "test.ftp.uri" ) + "/read-tests";
- m_manager.addProvider( "ftp", new FtpFileSystemProvider() );
- return m_manager.resolveFile( uri );
- }
-
- /**
- * Returns the URI for the area to do tests in.
- */
- protected FileObject getWriteFolder() throws Exception
- {
- final String uri = System.getProperty( "test.ftp.uri" ) + "/write-tests";
- return m_manager.resolveFile( uri );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/LocalFileSystemTestCase.java b/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/LocalFileSystemTestCase.java
deleted file mode 100644
index 540ec36f6..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/LocalFileSystemTestCase.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.aut.vfs.test;
-
-import java.io.File;
-import org.apache.aut.vfs.test.AbstractWritableFileSystemTestCase;
-import org.apache.aut.vfs.FileObject;
-
-/**
- * Tests for the local file system.
- *
- * @author Adam Murdoch
- */
-public class LocalFileSystemTestCase extends AbstractWritableFileSystemTestCase
-{
- public LocalFileSystemTestCase( String name )
- {
- super( name );
- }
-
- /**
- * Returns the URI for the base folder.
- */
- protected FileObject getBaseFolder() throws Exception
- {
- final File testDir = getTestResource( "basedir" );
- return m_manager.convert( testDir );
- }
-
- /**
- * Returns the URI for the area to do tests in.
- */
- protected FileObject getWriteFolder() throws Exception
- {
- final File testDir = getTestResource( "write-tests" );
- return m_manager.convert( testDir );
- }
-
- /**
- * Tests resolution of an absolute file name.
- */
- public void testAbsoluteFileName() throws Exception
- {
- // Locate file by absolute file name
- String fileName = new File( "testdir" ).getAbsolutePath();
- FileObject absFile = m_manager.resolveFile( fileName );
-
- // Locate file by URI
- String uri = "file://" + fileName.replace( File.separatorChar, '/' );
- FileObject uriFile = m_manager.resolveFile( uri );
-
- assertSame( "file object", absFile, uriFile );
- }
-
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/NestedZipFileSystemTestCase.java b/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/NestedZipFileSystemTestCase.java
deleted file mode 100644
index 652dcf5b9..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/NestedZipFileSystemTestCase.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.aut.vfs.test;
-
-import org.apache.aut.vfs.provider.zip.ZipFileSystemProvider;
-import org.apache.aut.vfs.test.AbstractReadOnlyFileSystemTestCase;
-import org.apache.aut.vfs.FileObject;
-
-/**
- * Tests for the Zip file system, using a zip file nested inside another zip file.
- *
- * @author Adam Murdoch
- */
-public class NestedZipFileSystemTestCase
- extends AbstractReadOnlyFileSystemTestCase
-{
- public NestedZipFileSystemTestCase( String name )
- {
- super( name );
- }
-
- /**
- * Returns the URI for the base folder.
- */
- protected FileObject getBaseFolder() throws Exception
- {
- m_manager.addProvider( "zip", new ZipFileSystemProvider() );
-
- // Locate the base Zip file
- final String zipFilePath = getTestResource( "nested.zip" ).getAbsolutePath();
- String uri = "zip:" + zipFilePath + "!/test.zip";
- final FileObject zipFile = m_manager.resolveFile( uri );
-
- // Now build the nested file system
- final FileObject nestedFS = m_manager.createFileSystem( "zip", zipFile );
- return nestedFS.resolveFile( "/basedir" );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/SmbFileSystemTestCase.java b/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/SmbFileSystemTestCase.java
deleted file mode 100644
index bf0402376..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/SmbFileSystemTestCase.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.aut.vfs.test;
-
-import org.apache.aut.vfs.provider.smb.SmbFileSystemProvider;
-import org.apache.aut.vfs.test.AbstractWritableFileSystemTestCase;
-import org.apache.aut.vfs.FileObject;
-
-/**
- * Tests for the SMB file system.
- *
- * @author Adam Murdoch
- */
-public class SmbFileSystemTestCase extends AbstractWritableFileSystemTestCase
-{
- public SmbFileSystemTestCase( String name )
- {
- super( name );
- }
-
- /**
- * Returns the URI for the base folder.
- */
- protected FileObject getBaseFolder() throws Exception
- {
- final String uri = System.getProperty( "test.smb.uri" ) + "/read-tests";
- m_manager.addProvider( "smb", new SmbFileSystemProvider() );
- return m_manager.resolveFile( uri );
- }
-
- /**
- * Returns the URI for the area to do tests in.
- */
- protected FileObject getWriteFolder() throws Exception
- {
- final String uri = System.getProperty( "test.smb.uri" ) + "/write-tests";
- return m_manager.resolveFile( uri );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/ZipFileSystemTestCase.java b/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/ZipFileSystemTestCase.java
deleted file mode 100644
index ded939ef6..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/ZipFileSystemTestCase.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.aut.vfs.test;
-
-import java.io.File;
-import org.apache.aut.vfs.provider.zip.ZipFileSystemProvider;
-import org.apache.aut.vfs.test.AbstractReadOnlyFileSystemTestCase;
-import org.apache.aut.vfs.FileObject;
-
-/**
- * Tests for the Zip file system.
- *
- * @author Adam Murdoch
- */
-public class ZipFileSystemTestCase extends AbstractReadOnlyFileSystemTestCase
-{
- public ZipFileSystemTestCase( String name )
- {
- super( name );
- }
-
- /**
- * Returns the URI for the base folder.
- */
- protected FileObject getBaseFolder() throws Exception
- {
- File zipFile = getTestResource( "test.zip" );
- String uri = "zip:" + zipFile.getAbsolutePath() + "!basedir";
- m_manager.addProvider( "zip", new ZipFileSystemProvider() );
- return m_manager.resolveFile( uri );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/basedir/dir1/file1.txt b/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/basedir/dir1/file1.txt
deleted file mode 100644
index e69de29bb..000000000
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/basedir/dir1/file2.txt b/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/basedir/dir1/file2.txt
deleted file mode 100644
index e69de29bb..000000000
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/basedir/dir1/file3.txt b/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/basedir/dir1/file3.txt
deleted file mode 100644
index e69de29bb..000000000
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/basedir/empty.txt b/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/basedir/empty.txt
deleted file mode 100644
index e69de29bb..000000000
diff --git a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/basedir/file1.txt b/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/basedir/file1.txt
deleted file mode 100644
index e7dead2c1..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/aut/vfs/test/basedir/file1.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-This is a test file.
-With 2 lines in it.
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/AbstractMyrmidonTest.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/AbstractMyrmidonTest.java
deleted file mode 100644
index fbef96e5a..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/AbstractMyrmidonTest.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon;
-
-import java.io.File;
-import java.io.IOException;
-import junit.framework.TestCase;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.framework.ExceptionUtil;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.myrmidon.frontends.BasicLogger;
-
-/**
- * A base class for Myrmidon tests. Provides utility methods for locating
- * test resources.
- *
- * @author Adam Murdoch
- */
-public abstract class AbstractMyrmidonTest
- extends TestCase
-{
- private final File m_testBaseDir;
- private final File m_baseDir;
- private Logger m_logger;
-
- protected static final Resources getResourcesForTested( final Class clazz )
- {
- final Package pkg = clazz.getPackage();
-
- String baseName;
- if( null == pkg )
- {
- final String name = clazz.getName();
- if( -1 == name.lastIndexOf( "." ) )
- {
- baseName = "";
- }
- else
- {
- baseName = name.substring( 0, name.lastIndexOf( "." ) );
- }
- }
- else
- {
- baseName = pkg.getName();
- }
-
- if( baseName.endsWith( ".test" ) )
- {
- baseName = baseName.substring( 0, baseName.length() - 5 );
- }
-
- return ResourceManager.getBaseResources( baseName + ".Resources", AbstractMyrmidonTest.class.getClassLoader() );
- }
-
- public AbstractMyrmidonTest( String name )
- {
- super( name );
- final String baseDirProp = System.getProperty( "test.basedir" );
- m_baseDir = getCanonicalFile( new File( baseDirProp ) );
- String packagePath = getClass().getName();
- int idx = packagePath.lastIndexOf( '.' );
- packagePath = packagePath.substring( 0, idx );
- packagePath = packagePath.replace( '.', File.separatorChar );
- m_testBaseDir = getCanonicalFile( new File( m_baseDir, packagePath ) );
- }
-
- /**
- * Locates a test resource, and asserts that the resource exists
- *
- * @param name path of the resource, relative to this test's base directory.
- */
- protected File getTestResource( final String name )
- {
- return getTestResource( name, true );
- }
-
- /**
- * Locates a test resource.
- *
- * @param name path of the resource, relative to this test's base directory.
- */
- protected File getTestResource( final String name, final boolean mustExist )
- {
- File file = new File( m_testBaseDir, name );
- file = getCanonicalFile( file );
- if( mustExist )
- {
- assertTrue( "Test file \"" + file + "\" does not exist.", file.exists() );
- }
- else
- {
- assertTrue( "Test file \"" + file + "\" should not exist.", !file.exists() );
- }
-
- return file;
- }
-
- /**
- * Locates the base directory for this test.
- */
- protected File getTestDirectory()
- {
- return m_testBaseDir;
- }
-
- /**
- * Locates a test directory, creating it if it does not exist.
- *
- * @param name path of the directory, relative to this test's base directory.
- */
- protected File getTestDirectory( final String name )
- {
- File file = new File( m_testBaseDir, name );
- file = getCanonicalFile( file );
- assertTrue( "Test directory \"" + file + "\" does not exist or is not a directory.",
- file.isDirectory() || file.mkdirs() );
- return file;
- }
-
- /**
- * Returns the directory containing a Myrmidon install.
- */
- protected File getHomeDirectory()
- {
- final File file = new File( m_baseDir, "dist" );
- return getCanonicalFile( file );
- }
-
- /**
- * Makes a file canonical
- */
- private File getCanonicalFile( final File file )
- {
- try
- {
- return file.getCanonicalFile();
- }
- catch( IOException e )
- {
- return file.getAbsoluteFile();
- }
- }
-
- /**
- * Creates a logger.
- */
- protected Logger getLogger()
- {
- if( m_logger == null )
- {
- m_logger = new BasicLogger( "[test]", BasicLogger.LEVEL_WARN );
- }
- return m_logger;
- }
-
- /**
- * Asserts that an exception chain contains the expected messages.
- *
- * @param messages The messages, in order. A null entry in this array
- * indicates that the message should be ignored.
- */
- protected void assertSameMessage( final String[] messages, final Throwable throwable )
- {
- //System.out.println( "exception:" );
- //for( Throwable t = throwable; t != null; t = ExceptionUtil.getCause( t, true ) )
- //{
- // System.out.println( " " + t.getMessage() );
- //}
-
- Throwable current = throwable;
- for( int i = 0; i < messages.length; i++ )
- {
- String message = messages[ i ];
- assertNotNull( current );
- if( message != null )
- {
- assertEquals( message, current.getMessage() );
- }
-
- // Get the next exception in the chain
- current = ExceptionUtil.getCause( current, true );
- }
- }
-
- /**
- * Asserts that an exception contains the expected message.
- */
- protected void assertSameMessage( final String message, final Throwable throwable )
- {
- assertSameMessage( new String[]{message}, throwable );
- }
-
- /**
- * Compares 2 objects for equality, nulls are equal. Used by the test
- * classes' equals() methods.
- */
- public static boolean equals( final Object o1, final Object o2 )
- {
- if( o1 == null && o2 == null )
- {
- return true;
- }
- if( o1 == null || o2 == null )
- {
- return false;
- }
- return o1.equals( o2 );
- }
-
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/AbstractProjectTest.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/AbstractProjectTest.java
deleted file mode 100644
index 371e341da..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/AbstractProjectTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon;
-
-import java.io.File;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.myrmidon.components.embeddor.DefaultEmbeddor;
-import org.apache.myrmidon.interfaces.embeddor.Embeddor;
-import org.apache.myrmidon.interfaces.model.Project;
-import org.apache.myrmidon.interfaces.workspace.Workspace;
-import org.apache.myrmidon.listeners.ProjectListener;
-
-/**
- * A base class for test cases which need to execute projects.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class AbstractProjectTest
- extends AbstractMyrmidonTest
-{
- private DefaultEmbeddor m_embeddor;
-
- public AbstractProjectTest( final String name )
- {
- super( name );
- }
-
- /**
- * Tear-down the test.
- */
- protected void tearDown() throws Exception
- {
- if( m_embeddor != null )
- {
- m_embeddor.dispose();
- m_embeddor = null;
- }
- }
-
- /**
- * Returns an embeddor which can be used to build and execute projects.
- */
- protected Embeddor getEmbeddor() throws Exception
- {
- if( m_embeddor == null )
- {
- // Need to set the context classloader - The default embeddor uses it
- Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );
-
- final Logger logger = getLogger();
- m_embeddor = new DefaultEmbeddor();
- m_embeddor.enableLogging( logger );
-
- final Parameters params = new Parameters();
- final File instDir = getHomeDirectory();
- params.setParameter( "myrmidon.home", instDir.getAbsolutePath() );
- m_embeddor.parameterize( params );
- m_embeddor.initialize();
- m_embeddor.start();
- }
-
- return m_embeddor;
- }
-
- /**
- * Executes a target in a project, and asserts that it fails with the
- * given error message.
- */
- protected void executeTargetExpectError( final File projectFile,
- final String targetName,
- final String message )
- {
- executeTargetExpectError( projectFile, targetName, new String[]{message} );
- }
-
- /**
- * Executes a target in a project, and asserts that it fails with the
- * given error messages.
- */
- protected void executeTargetExpectError( final File projectFile,
- final String targetName,
- final String[] messages )
- {
- try
- {
- executeTarget( projectFile, targetName, null );
- fail( "target execution did not fail" );
- }
- catch( Exception e )
- {
- assertSameMessage( messages, e );
- }
- }
-
- /**
- * Executes a target in a project, and asserts that it does not fail.
- */
- protected void executeTarget( final File projectFile, final String targetName )
- throws Exception
- {
- executeTarget( projectFile, targetName, null );
- }
-
- /**
- * Executes a target in a project, and asserts that it does not fail.
- */
- protected void executeTarget( final File projectFile,
- final String targetName,
- final ProjectListener listener )
- throws Exception
- {
- // Create the project and workspace
- final Embeddor embeddor = getEmbeddor();
- final Project project = embeddor.createProject( projectFile.getAbsolutePath(), null, null );
- final Workspace workspace = embeddor.createWorkspace( new Parameters() );
-
- // Add a listener to make sure all is good
- final TrackingProjectListener tracker = new TrackingProjectListener();
- workspace.addProjectListener( tracker );
-
- // Add supplied listener
- if( listener != null )
- {
- workspace.addProjectListener( listener );
- }
-
- // Now execute the target
- workspace.executeProject( project, targetName );
-
- // Make sure all expected events were delivered
- tracker.assertComplete();
- if( listener instanceof TrackingProjectListener )
- {
- ( (TrackingProjectListener)listener ).assertComplete();
- }
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/DependencyMetricsTest.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/DependencyMetricsTest.java
deleted file mode 100644
index 63f37ee67..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/DependencyMetricsTest.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import jdepend.framework.JDepend;
-import jdepend.framework.JavaPackage;
-import junit.framework.TestCase;
-
-/**
- * An abstract Unit test that can be used to test Dependency metrics
- * fall in acceptable limits.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class DependencyMetricsTest
- extends TestCase
-{
- private JDepend m_jDepend;
-
- public DependencyMetricsTest( final String name )
- {
- super( name );
- }
-
- /**
- * Sets up the test fixture.
- *
- * Called before every test case method.
- */
- protected void setUp()
- {
- m_jDepend = new JDepend();
-
- try
- {
-
- m_jDepend.addDirectory( "src/java" );
- //m_jDepend.addDirectory( "src/main" );
- }
- catch( final IOException ioe )
- {
- fail( ioe.getMessage() );
- }
-
- m_jDepend.analyze();
- }
-
- /**
- * Tears down the test fixture.
- *
- * Called after every test case method.
- */
- protected void tearDown()
- {
- m_jDepend = null;
- }
-
- /**
- * Utility method to retrieve JDpenden instance that contains statistics.
- */
- protected final JDepend getJDepend()
- {
- return m_jDepend;
- }
-
- /**
- * Make sure that the launcher classes in org.apache.myrmidon.launcher.*
- * are completely decoupled from the rest of the system.
- */
- public void testLauncherDecoupled()
- {
- final JDepend jDepend = getJDepend();
- final String name = "org.apache.myrmidon.launcher";
- final JavaPackage javaPackage = jDepend.getPackage( name );
-
- final Collection efferentSet = javaPackage.getEfferents();
- final Iterator afferents = efferentSet.iterator();
- while( afferents.hasNext() )
- {
- final JavaPackage efferent = (JavaPackage)afferents.next();
- final String efferentName = efferent.getName();
- if( ! isSubPackage( name, efferentName ) )
- {
- fail( "The launcher package " + name + " depends on external classes " +
- "contained in " + efferentName + ". No classes besides " +
- "those in the launcher hierarchy should be referenced" );
- }
- }
- }
-
- /**
- * Make sure that the implementations of the myrmidon kernel components
- * (ie org.apache.myrmidon.component.X.*) are not referenced by anyone
- * except by other objects in the same package or child packages.
- */
- public void testNoComponentImplSharing()
- {
- final JDepend jDepend = getJDepend();
- final Collection packageSet = jDepend.getPackages();
-
- final Iterator packages = packageSet.iterator();
- while( packages.hasNext() )
- {
- final JavaPackage javaPackage = (JavaPackage)packages.next();
- final String name = javaPackage.getName();
- final String componentPackage = "org.apache.myrmidon.components.";
- if( !name.startsWith( componentPackage ) )
- {
- continue;
- }
-
- // Extract the component package
- final int start = componentPackage.length() + 1;
- final int end = name.indexOf( '.', start );
- final String component;
- if( end > -1 )
- {
- component = name.substring( end );
- }
- else
- {
- component = name;
- }
-
- // Make sure that all the afferent packages of this package (i.e.
- // those that refer to this package) are sub-packages of the
- // component package
- final Collection afferentSet = javaPackage.getAfferents();
- final Iterator afferents = afferentSet.iterator();
- while( afferents.hasNext() )
- {
- final JavaPackage efferent = (JavaPackage)afferents.next();
- final String efferentName = efferent.getName();
- if( !isSubPackage( component, efferentName ) )
- {
- fail( "The package " + name + " is referred to by classes " +
- "contained in " + efferentName + ". No classes besides " +
- "those part of the particular implementation of kernel " +
- "component should reference the implementations" );
- }
- }
- }
- }
-
- /**
- * Make sure that aut does not depend on any other ant classes
- * and thus can be cleanly decoupled.
- */
- public void testAutDecoupled()
- {
- final String packageName = "org.apache.aut";
- final String[] badEfferents = new String[]
- {
- "org.apache.myrmidon", "org.apache.antlib", "org.apache.tools.ant"
- };
- doTestDecoupled( packageName, badEfferents );
- }
-
- /**
- * Make sure that myrmidon package does not have any
- * unwanted dependencies.
- */
- /*
- public void testMyrmidonDecoupled()
- {
- final String packageName = "org.apache.myrmidon";
- final String[] badEfferents = new String[]
- {
- "org.apache.antlib", "org.apache.tools.ant"
- };
- doTestDecoupled( packageName, badEfferents );
- }
- */
-
- /**
- * Make sure that antlib package does not have any
- * unwanted dependencies.
- */
- /*
- public void testAntlibDecoupled()
- {
- final String packageName = "org.apache.antlib";
- final String[] badEfferents = new String[]
- {
- "org.apache.tools.ant"
- };
- doTestDecoupled( packageName, badEfferents );
- }
- */
- /**
- * Make sure there are no circular dependencies between packages because
- * circular dependencies are evil!!!
- */
- public void testNoCircularity()
- {
- final JDepend jDepend = getJDepend();
- final Collection packageSet = jDepend.getPackages();
- final Iterator packages = packageSet.iterator();
- while( packages.hasNext() )
- {
- final JavaPackage javaPackage = (JavaPackage)packages.next();
- if( javaPackage.containsCycle() )
- {
- final ArrayList cycle = new ArrayList();
- javaPackage.collectCycle( cycle );
-
- final ArrayList names = getPackageNames( cycle );
- fail( "The package " + javaPackage.getName() + " contains a cycle " +
- "with a path " + names );
- }
- }
- }
-
- private ArrayList getPackageNames( final ArrayList cycle )
- {
- final ArrayList names = new ArrayList();
-
- final int size = cycle.size();
- for( int i = 0; i < size; i++ )
- {
- final JavaPackage javaPackage = (JavaPackage)cycle.get( i );
- names.add( javaPackage.getName() );
- }
-
- return names;
- }
-
- /**
- * Make sure that the specified package does not depend on any
- * of the specified package hierarchies.
- */
- private void doTestDecoupled( final String packageName,
- final String[] invalidEfferents )
- {
- final JDepend jDepend = getJDepend();
- final Collection packageSet = jDepend.getPackages();
-
- final Iterator packages = packageSet.iterator();
- while( packages.hasNext() )
- {
- final JavaPackage javaPackage = (JavaPackage)packages.next();
- final String name = javaPackage.getName();
- if( !isSubPackage( packageName, name ) )
- {
- continue;
- }
-
- final Collection efferentSet = javaPackage.getEfferents();
- final Iterator efferents = efferentSet.iterator();
- while( efferents.hasNext() )
- {
- final JavaPackage efferent = (JavaPackage)efferents.next();
- final String efferentName = efferent.getName();
- for( int i = 0; i < invalidEfferents.length; i++ )
- {
- final String other = invalidEfferents[ i ];
- if( isSubPackage( other, efferentName ) )
- {
- fail( "The package " + name + " has an unwanted dependency " +
- "on classes contained in " + efferentName );
- }
- }
- }
- }
- }
-
- /**
- * Determines if a package is a sub-package of another package.
- *
- * @return true if subpackage
is either the same package as
- * basePackage
, or a sub-package of it.
- */
- private boolean isSubPackage( final String basePackage,
- final String subpackage )
- {
- if( ! subpackage.startsWith( basePackage ) )
- {
- return false;
- }
- return ( subpackage.length() == basePackage.length()
- || subpackage.charAt( basePackage.length() ) == '.' );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/LogMessageTracker.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/LogMessageTracker.java
deleted file mode 100644
index be5f53b04..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/LogMessageTracker.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.myrmidon.listeners.LogEvent;
-
-/**
- * Asserts that log messages are delivered in the correct order.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class LogMessageTracker
- extends TrackingProjectListener
-{
- private List m_targets = new ArrayList();
- private List m_messages = new ArrayList();
-
- /**
- * Handles a log message.
- */
- public void log( final LogEvent event )
- {
- super.log( event );
-
- // Pop the next expected message off the list, and make sure it
- // matches the message in the event
- assertTrue( "Unexpected log message", m_targets.size() > 0 && m_messages.size() > 0 );
- assertEquals( "Unexpected log message", m_targets.remove( 0 ), event.getTargetName() );
- assertEquals( "Unexpected log message", m_messages.remove( 0 ), event.getMessage() );
- }
-
- /**
- * Asserts that all the log messages were delivered.
- */
- public void assertComplete()
- {
- super.assertComplete();
-
- // Make sure that all log messages were delivered
- assertTrue( "Log message not delivered", m_targets.size() == 0 && m_messages.size() == 0 );
- }
-
- /**
- * Adds an expected log message.
- */
- public void addExpectedMessage( String target, String message )
- {
- m_targets.add( target );
- m_messages.add( message );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/TrackingProjectListener.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/TrackingProjectListener.java
deleted file mode 100644
index 9ddf03f1f..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/TrackingProjectListener.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon;
-
-import junit.framework.Assert;
-import org.apache.myrmidon.listeners.LogEvent;
-import org.apache.myrmidon.listeners.ProjectEvent;
-import org.apache.myrmidon.listeners.ProjectListener;
-import org.apache.myrmidon.listeners.TargetEvent;
-import org.apache.myrmidon.listeners.TaskEvent;
-
-/**
- * A project listener that asserts that it receives a particular sequence of
- * events.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class TrackingProjectListener
- extends Assert
- implements ProjectListener
-{
- private String m_rootProject;
- private String m_currentProject;
- private String m_currentTarget;
- private String m_currentTask;
-
- /**
- * Notify the listener that a project is about to start.
- */
- public void projectStarted( final ProjectEvent event )
- {
- assertNull( "Project already started", m_rootProject );
- m_rootProject = event.getProjectName();
- }
-
- /**
- * Notify the listener that a project has finished.
- */
- public void projectFinished( final ProjectEvent event )
- {
- assertEquals( "Mismatched project name", m_rootProject, event.getProjectName() );
- m_rootProject = null;
-
- assertNull( "Target not started", m_currentTarget );
- }
-
- /**
- * Notify the listener that a target is about to start.
- */
- public void targetStarted( final TargetEvent event )
- {
- assertNotNull( "Project not started", m_rootProject );
- assertNull( "Target already started", m_currentTarget );
- m_currentProject = event.getProjectName();
- m_currentTarget = event.getTargetName();
- }
-
- /**
- * Notify the listener that a target has finished.
- */
- public void targetFinished( final TargetEvent event )
- {
- assertEquals( "Mismatched project name", m_currentProject, event.getProjectName() );
- assertEquals( "Mismatched target name", m_currentTarget, event.getTargetName() );
- m_currentProject = null;
- m_currentTarget = null;
-
- assertNull( "Task not finished", m_currentTask );
- }
-
- /**
- * Notify the listener that a task is about to start.
- */
- public void taskStarted( final TaskEvent event )
- {
- assertEquals( "Mismatched project name", m_currentProject, event.getProjectName() );
- assertEquals( "Mismatched target name", m_currentTarget, event.getTargetName() );
-
- assertNull( "Task already started", m_currentTask );
- m_currentTask = event.getTaskName();
- }
-
- /**
- * Notify the listener that a task has finished.
- */
- public void taskFinished( final TaskEvent event )
- {
- assertEquals( "Mismatched project name", m_currentProject, event.getProjectName() );
- assertEquals( "Mismatched target name", m_currentTarget, event.getTargetName() );
- assertEquals( "Mismatched task name", m_currentTask, event.getTaskName() );
- m_currentTask = null;
- }
-
- /**
- * Notify listener of log message event.
- */
- public void log( final LogEvent event )
- {
- assertEquals( "Mismatched project name", m_currentProject, event.getProjectName() );
- assertEquals( "Mismatched target name", m_currentTarget, event.getTargetName() );
- assertEquals( "Mismatched task name", m_currentTask, event.getTaskName() );
- assertNull( "Unexpected build error", event.getThrowable() );
- }
-
- /**
- * Asserts that the listener has finished.
- */
- public void assertComplete()
- {
- assertNull( "Task not finished", m_currentTask );
- assertNull( "Target not finished", m_currentTarget );
- assertNull( "Target not finished", m_currentProject );
- assertNull( "Project not finished", m_rootProject );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/AbstractComponentTest.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/AbstractComponentTest.java
deleted file mode 100644
index b50c65df9..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/AbstractComponentTest.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.apache.aut.converter.Converter;
-import org.apache.avalon.framework.logger.LogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.service.DefaultServiceManager;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.myrmidon.AbstractMyrmidonTest;
-import org.apache.myrmidon.components.classloader.DefaultClassLoaderManager;
-import org.apache.myrmidon.components.configurer.DefaultConfigurer;
-import org.apache.myrmidon.components.converter.DefaultConverterRegistry;
-import org.apache.myrmidon.components.converter.DefaultMasterConverter;
-import org.apache.myrmidon.components.deployer.DefaultDeployer;
-import org.apache.myrmidon.components.executor.DefaultExecutor;
-import org.apache.myrmidon.components.extensions.DefaultExtensionManager;
-import org.apache.myrmidon.components.property.DefaultPropertyResolver;
-import org.apache.myrmidon.components.role.DefaultRoleManager;
-import org.apache.myrmidon.components.type.DefaultTypeManager;
-import org.apache.myrmidon.framework.DataType;
-import org.apache.myrmidon.interfaces.classloader.ClassLoaderManager;
-import org.apache.myrmidon.interfaces.configurer.Configurer;
-import org.apache.myrmidon.interfaces.converter.ConverterRegistry;
-import org.apache.myrmidon.interfaces.deployer.Deployer;
-import org.apache.myrmidon.interfaces.executor.Executor;
-import org.apache.myrmidon.interfaces.extensions.ExtensionManager;
-import org.apache.myrmidon.interfaces.property.PropertyResolver;
-import org.apache.myrmidon.interfaces.role.RoleInfo;
-import org.apache.myrmidon.interfaces.role.RoleManager;
-import org.apache.myrmidon.interfaces.service.ServiceFactory;
-import org.apache.myrmidon.interfaces.type.DefaultTypeFactory;
-import org.apache.myrmidon.interfaces.type.TypeManager;
-
-/**
- * A base class for tests for the default components.
- *
- * @author Adam Murdoch
- */
-public abstract class AbstractComponentTest
- extends AbstractMyrmidonTest
-{
- private DefaultServiceManager m_serviceManager;
-
- public static final String DATA_TYPE_ROLE = "data-type";
- public static final String CONVERTER_ROLE = "converter";
- public static final String SERVICE_FACTORY_ROLE = "service-factory";
-
- public AbstractComponentTest( final String name )
- {
- super( name );
- }
-
- /**
- * Returns the component manager containing the components to test.
- */
- protected final ServiceManager getServiceManager() throws Exception
- {
- if( m_serviceManager == null )
- {
- Logger logger = getLogger();
-
- // Create the components
- m_serviceManager = new DefaultServiceManager();
- List components = new ArrayList();
-
- Object component = createComponent( Converter.ROLE, DefaultMasterConverter.class );
- m_serviceManager.put( Converter.ROLE, component );
- components.add( component );
-
- component = createComponent( ConverterRegistry.ROLE, DefaultConverterRegistry.class );
- m_serviceManager.put( ConverterRegistry.ROLE, component );
- components.add( component );
-
- component = createComponent( TypeManager.ROLE, DefaultTypeManager.class );
- m_serviceManager.put( TypeManager.ROLE, component );
- components.add( component );
-
- component = createComponent( Configurer.ROLE, DefaultConfigurer.class );
- m_serviceManager.put( Configurer.ROLE, component );
- components.add( component );
-
- component = createComponent( Deployer.ROLE, DefaultDeployer.class );
- m_serviceManager.put( Deployer.ROLE, component );
- components.add( component );
-
- component = createComponent( Executor.ROLE, DefaultExecutor.class );
- m_serviceManager.put( Executor.ROLE, component );
- components.add( component );
-
- final DefaultClassLoaderManager classLoaderMgr = new DefaultClassLoaderManager();
- classLoaderMgr.setBaseClassLoader( getClass().getClassLoader() );
- m_serviceManager.put( ClassLoaderManager.ROLE, classLoaderMgr );
- components.add( classLoaderMgr );
-
- component = createComponent( ExtensionManager.ROLE, DefaultExtensionManager.class );
- m_serviceManager.put( ExtensionManager.ROLE, component );
- components.add( component );
-
- component = createComponent( RoleManager.ROLE, DefaultRoleManager.class );
- m_serviceManager.put( RoleManager.ROLE, component );
- components.add( component );
-
- component = createComponent( PropertyResolver.ROLE, DefaultPropertyResolver.class );
- m_serviceManager.put( PropertyResolver.ROLE, component );
- components.add( component );
-
- // Log enable the components
- for( Iterator iterator = components.iterator(); iterator.hasNext(); )
- {
- Object obj = iterator.next();
- if( obj instanceof LogEnabled )
- {
- final LogEnabled logEnabled = (LogEnabled)obj;
- logEnabled.enableLogging( logger );
- }
- }
-
- // Compose the components
- for( Iterator iterator = components.iterator(); iterator.hasNext(); )
- {
- Object obj = iterator.next();
- if( obj instanceof Serviceable )
- {
- final Serviceable serviceable = (Serviceable)obj;
- serviceable.service( m_serviceManager );
- }
- }
-
- // Register some standard roles
- // Add some core roles
- final RoleManager roleManager = (RoleManager)getServiceManager().lookup( RoleManager.ROLE );
- roleManager.addRole( new RoleInfo( DataType.ROLE, DATA_TYPE_ROLE, DataType.class ) );
- roleManager.addRole( new RoleInfo( Converter.ROLE, CONVERTER_ROLE, Converter.class ) );
- roleManager.addRole( new RoleInfo( ServiceFactory.ROLE, SERVICE_FACTORY_ROLE, ServiceFactory.class ) );
- }
-
- return m_serviceManager;
- }
-
- /**
- * Creates an instance of a component. Sub-classes can override this
- * method to add a particular implementation to the set of test components.
- */
- protected Object createComponent( final String role, final Class defaultImpl )
- throws Exception
- {
- return defaultImpl.newInstance();
- }
-
- /**
- * Returns the type manager.
- */
- protected TypeManager getTypeManager()
- throws Exception
- {
- return (TypeManager)getServiceManager().lookup( TypeManager.ROLE );
- }
-
- /**
- * Utility method to register a role.
- */
- protected void registerRole( final RoleInfo roleInfo )
- throws Exception
- {
- RoleManager roleMgr = (RoleManager)getServiceManager().lookup( RoleManager.ROLE );
- roleMgr.addRole( roleInfo );
- }
-
- /**
- * Utility method to register a type.
- */
- protected void registerType( final String roleName,
- final String typeName,
- final Class type )
- throws Exception
- {
- final ClassLoader loader = getClass().getClassLoader();
- final DefaultTypeFactory factory = new DefaultTypeFactory( loader );
- factory.addNameClassMapping( typeName, type.getName() );
- getTypeManager().registerType( roleName, typeName, factory );
- }
-
- /**
- * Utility method to register a Converter.
- */
- protected void registerConverter( final Class converterClass,
- final Class sourceClass,
- final Class destClass )
- throws Exception
- {
- ConverterRegistry converterRegistry = (ConverterRegistry)getServiceManager().lookup( ConverterRegistry.ROLE );
- converterRegistry.registerConverter( converterClass.getName(), sourceClass.getName(), destClass.getName() );
- DefaultTypeFactory factory = new DefaultTypeFactory( getClass().getClassLoader() );
- factory.addNameClassMapping( converterClass.getName(), converterClass.getName() );
- getTypeManager().registerType( Converter.ROLE, converterClass.getName(), factory );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/DefaultProjectBuilderTestCase.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/DefaultProjectBuilderTestCase.java
deleted file mode 100644
index af901c97d..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/DefaultProjectBuilderTestCase.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.builder.test;
-
-import java.io.File;
-import java.util.Arrays;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.avalon.excalibur.io.FileUtil;
-import org.apache.myrmidon.AbstractMyrmidonTest;
-import org.apache.myrmidon.components.builder.DefaultProjectBuilder;
-import org.apache.myrmidon.components.builder.DefaultProject;
-import org.apache.myrmidon.interfaces.builder.ProjectException;
-import org.apache.myrmidon.interfaces.model.Project;
-
-/**
- * Test cases for {@link org.apache.myrmidon.components.builder.DefaultProjectBuilder}.
- *
- * @author Darrell DeBoer
- * @version $Revision$ $Date$
- */
-public class DefaultProjectBuilderTestCase
- extends AbstractMyrmidonTest
-{
- private final static Resources REZ = getResourcesForTested( DefaultProjectBuilderTestCase.class );
-
- private DefaultProjectBuilder m_builder;
-
- public DefaultProjectBuilderTestCase( String name )
- {
- super( name );
- }
-
- protected void setUp() throws Exception
- {
- super.setUp();
- m_builder = new DefaultProjectBuilder();
- m_builder.enableLogging( getLogger() );
- }
-
- /**
- * Creates a project, with default values set.
- */
- private DefaultProject createProject( final File projFile )
- {
- final DefaultProject project = new DefaultProject();
- project.setProjectName( FileUtil.removeExtension( projFile.getName() ) );
- project.setBaseDirectory( getTestDirectory( "." ) );
- project.setDefaultTargetName( "main" );
- return project;
- }
-
- /**
- * Tests bad project file name.
- */
- public void testProjectFileName() throws Exception
- {
- // Test with a file that does not exist
- File projFile = getTestResource( "unknown.ant", false );
-
- try
- {
- m_builder.build( projFile.getAbsolutePath() );
- fail();
- }
- catch( ProjectException e )
- {
- final String[] messages =
- {
- REZ.getString( "ant.project-build.error", projFile.getAbsolutePath() ),
- REZ.getString( "ant.no-project-file.error" )
- };
- assertSameMessage( messages, e );
- }
-
- // Test with a directory
- projFile = getTestDirectory( "some-dir" );
-
- try
- {
- m_builder.build( projFile.getAbsolutePath() );
- fail();
- }
- catch( ProjectException e )
- {
- final String[] messages =
- {
- REZ.getString( "ant.project-build.error", projFile.getAbsolutePath() ),
- REZ.getString( "ant.no-project-file.error" )
- };
- assertSameMessage( messages, e );
- }
- }
-
- /**
- * Tests error reporting when the project file contains badly formed XML.
- */
- public void testBadlyFormedFile() throws Exception
- {
- final File projFile = getTestResource( "bad-xml.ant" );
- try
- {
- m_builder.build( projFile.getAbsolutePath() );
- fail();
- }
- catch( ProjectException e )
- {
- final String[] messages =
- {
- REZ.getString( "ant.project-build.error", projFile.getAbsolutePath() ),
- REZ.getString( "ant.project-parse.error" )
- };
- assertSameMessage( messages, e );
- }
- }
-
- /**
- * Tests building a project with default values for project name, base dir
- * and default target.
- */
- public void testDefaults() throws Exception
- {
- // Build project
- final File projFile = getTestResource( "defaults.ant" );
- Project project = m_builder.build( projFile.getAbsolutePath() );
-
- // Compare against expected project
- DefaultProject expected = createProject( projFile );
- assertSameProject( expected, project );
- }
-
- /**
- * Tests setting the project name.
- */
- public void testProjectName() throws Exception
- {
- // Build project
- final File projFile = getTestResource( "set-project-name.ant" );
- Project project = m_builder.build( projFile.getAbsolutePath() );
-
- // Compare against expected project
- DefaultProject expected = createProject( projFile );
- expected.setProjectName( "some-project" );
- assertSameProject( expected, project );
- }
-
- /**
- * Tests setting the base directory.
- */
- public void testBaseDirectory() throws Exception
- {
- // Build project
- final File projFile = getTestResource( "set-base-dir.ant" );
- Project project = m_builder.build( projFile.getAbsolutePath() );
-
- // Compare against expected project
- DefaultProject expected = createProject( projFile );
- final File baseDir = getTestDirectory( "other-base-dir" );
- expected.setBaseDirectory( baseDir );
- assertSameProject( expected, project );
- }
-
- /**
- * Tests setting the default target name.
- */
- public void testDefaultTarget() throws Exception
- {
- // Build project
- final File projFile = getTestResource( "set-default-target.ant" );
- Project project = m_builder.build( projFile.getAbsolutePath() );
-
- // Compare against expected project
- DefaultProject expected = createProject( projFile );
- expected.setDefaultTargetName( "some-target" );
- assertSameProject( expected, project );
- }
-
- /**
- * Tests missing, invalid and incompatible project version.
- */
- public void testProjectVersion() throws Exception
- {
- // No version
- File projFile = getTestResource( "no-version.ant" );
- try
- {
- m_builder.build( projFile.getAbsolutePath() );
- fail();
- }
- catch( ProjectException e )
- {
- final String[] messages =
- {
- REZ.getString( "ant.project-build.error", projFile.getAbsolutePath() ),
- REZ.getString( "ant.version-missing.error" )
- };
- assertSameMessage( messages, e );
- }
-
- // Badly formed version
- projFile = getTestResource( "bad-version.ant" );
- try
- {
- m_builder.build( projFile.getAbsolutePath() );
- fail();
- }
- catch( ProjectException e )
- {
- final String[] messages =
- {
- REZ.getString( "ant.project-build.error", projFile.getAbsolutePath() ),
- REZ.getString( "ant.malformed.version", "ant2" )
- };
- assertSameMessage( messages, e );
- }
-
- // Incompatible version
- projFile = getTestResource( "mismatched-version.ant" );
- try
- {
- m_builder.build( projFile.getAbsolutePath() );
- fail();
- }
- catch( ProjectException e )
- {
- final String[] messages =
- {
- REZ.getString( "ant.project-build.error", projFile.getAbsolutePath() ),
- REZ.getString( "ant.bad-version.error", "2.0.0", "1.0.2" )
- };
- assertSameMessage( messages, e );
- }
- }
-
- /**
- * Asserts that 2 projects are identical.
- */
- protected void assertSameProject( final Project expected,
- final Project project )
- {
- assertEquals( expected.getProjectName(), project.getProjectName() );
- assertEquals( expected.getBaseDirectory(), project.getBaseDirectory() );
- assertEquals( expected.getDefaultTargetName(), project.getDefaultTargetName() );
-
- // TODO - make sure each of the projects are the same
- assertTrue( Arrays.equals( expected.getProjectNames(), project.getProjectNames() ) );
-
- // TODO - make sure the implicit targets are the same
-
- // TODO - make sure each of the targets are the same
- assertTrue( Arrays.equals( expected.getTargetNames(), project.getTargetNames() ) );
-
- // TODO - implement TypeLib.equals(), or use a comparator
- assertTrue( Arrays.equals( expected.getTypeLibs(), project.getTypeLibs() ) );
- }
-
- /**
- * Tests validation of project and target names.
- */
- public void testNameValidation() throws Exception
- {
- // Check bad project name
- final File badProjectFile = getTestResource( "bad-project-name.ant" );
- try
- {
- m_builder.build( badProjectFile.getAbsolutePath() );
- fail();
- }
- catch( Exception e )
- {
- final String[] messages =
- {
- REZ.getString( "ant.project-build.error", badProjectFile.getAbsolutePath() ),
- REZ.getString( "ant.project-bad-name.error" )
- };
- assertSameMessage( messages, e );
- }
-
- // Check bad target name
- final File badTargetFile = getTestResource( "bad-target-name.ant" );
- try
- {
- m_builder.build( badTargetFile.getAbsolutePath() );
- fail();
- }
- catch( Exception e )
- {
- final String[] messages =
- {
- REZ.getString( "ant.project-build.error", badTargetFile.getAbsolutePath() ),
- // TODO - check error message
- null
- };
- assertSameMessage( messages, e );
- }
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/bad-project-name.ant b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/bad-project-name.ant
deleted file mode 100644
index 7b0ed6f75..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/bad-project-name.ant
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/bad-target-name.ant b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/bad-target-name.ant
deleted file mode 100644
index 8c7186956..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/bad-target-name.ant
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/bad-version.ant b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/bad-version.ant
deleted file mode 100644
index 922f14aee..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/bad-version.ant
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/bad-xml.ant b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/bad-xml.ant
deleted file mode 100644
index 91717fd16..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/bad-xml.ant
+++ /dev/null
@@ -1 +0,0 @@
-this ain't xml.
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/defaults.ant b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/defaults.ant
deleted file mode 100644
index b36a5c7ce..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/defaults.ant
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/mismatched-version.ant b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/mismatched-version.ant
deleted file mode 100644
index b9176c9c0..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/mismatched-version.ant
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/no-version.ant b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/no-version.ant
deleted file mode 100644
index d1979fedf..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/no-version.ant
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/set-base-dir.ant b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/set-base-dir.ant
deleted file mode 100644
index 56fe72aa4..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/set-base-dir.ant
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/set-default-target.ant b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/set-default-target.ant
deleted file mode 100644
index f83f3bbeb..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/set-default-target.ant
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/set-project-name.ant b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/set-project-name.ant
deleted file mode 100644
index a8ae1a941..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/builder/test/set-project-name.ant
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/ConfigTestConfigurable.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/ConfigTestConfigurable.java
deleted file mode 100644
index 4a1d5d628..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/ConfigTestConfigurable.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test;
-
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-
-/**
- * Simple class to test {@link org.apache.avalon.framework.configuration.Configurable}.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class ConfigTestConfigurable
- implements Configurable
-{
- private Configuration m_configuration;
-
- public void configure( Configuration configuration )
- throws ConfigurationException
- {
- m_configuration = configuration;
- }
-
- public boolean equals( final Object object )
- {
- final ConfigTestConfigurable other = (ConfigTestConfigurable)object;
- return m_configuration == other.m_configuration;
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/DefaultConfigurerTestCase.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/DefaultConfigurerTestCase.java
deleted file mode 100644
index b14a85966..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/DefaultConfigurerTestCase.java
+++ /dev/null
@@ -1,859 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test;
-
-import java.io.File;
-import org.apache.antlib.core.StringToIntegerConverter;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.avalon.framework.ExceptionUtil;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.configuration.DefaultConfiguration;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.components.AbstractComponentTest;
-import org.apache.myrmidon.components.configurer.DefaultConfigurer;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestAttributeConvert;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestConfigAdder;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestContent;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestEmpty;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestIdResolve;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestIgnoreStringMethods;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestInterfaceAdder;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestMismatchedRefType;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestMultipleTypedAdder;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestNestedErrors;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestNonInterfaceAdder;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestPropResolution;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestReferenceAttribute;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestReferenceConversion;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestReferenceElement;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestSetAndAdd;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestSetAttribute;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestSetElement;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestTypedAdder;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestTypedAdderConversion;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestTypedAdderReference;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestTypedAdderRole;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestTypedConfigAdder;
-import org.apache.myrmidon.components.configurer.test.data.ConfigTestUnknownReference;
-import org.apache.myrmidon.components.workspace.DefaultTaskContext;
-import org.apache.myrmidon.framework.DataType;
-import org.apache.myrmidon.interfaces.configurer.Configurer;
-import org.apache.myrmidon.interfaces.role.RoleInfo;
-
-/**
- * Test cases for the default configurer and related classes.
- *
- * @author Adam Murdoch
- */
-public class DefaultConfigurerTestCase
- extends AbstractComponentTest
-{
- private final static Resources REZ =
- getResourcesForTested( DefaultConfigurerTestCase.class );
-
- private Configurer m_configurer;
- private DefaultTaskContext m_context;
-
- public DefaultConfigurerTestCase( String name )
- {
- super( name );
- }
-
- /**
- * Setup the test case - prepares a set of components, including the
- * configurer.
- */
- protected void setUp() throws Exception
- {
- super.setUp();
-
- // Find the configurer
- m_configurer = (Configurer)getServiceManager().lookup( Configurer.ROLE );
-
- // Setup a context
- m_context = new DefaultTaskContext( null, getServiceManager(), getLogger() );
- final File baseDir = new File( "." ).getAbsoluteFile();
- m_context.setProperty( TaskContext.BASE_DIRECTORY, baseDir );
- }
-
- /**
- * Creates an instance of a component. Sub-classes can override this
- * method to add a particular implementation to the set of test components.
- */
- protected Object createComponent( final String role, final Class defaultImpl )
- throws Exception
- {
- if( role.equals( Configurer.ROLE) )
- {
- return new DefaultConfigurer();
- }
- else
- {
- return super.createComponent( role, defaultImpl );
- }
- }
-
- /**
- * Tests setting an attribute, via a setter method.
- */
- public void testSetAttribute()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- final String value1 = "some value";
- config.setAttribute( "some-prop", value1 );
-
- final ConfigTestSetAttribute test = new ConfigTestSetAttribute();
-
- // Configure the object
- configure( test, config );
-
- // Check result
- final ConfigTestSetAttribute expected = new ConfigTestSetAttribute();
- expected.setSomeProp( value1 );
- assertEquals( expected, test );
- }
-
- /**
- * Tests attribute conversion.
- */
- public void testAttributeConvert()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- config.setAttribute( "int-prop", "90" );
- config.setAttribute( "integer-prop", "-401" );
-
- // Register the converter
- registerConverter( StringToIntegerConverter.class, String.class, Integer.class );
-
- final ConfigTestAttributeConvert test = new ConfigTestAttributeConvert();
-
- // Configure the object
- configure( test, config );
-
- // Check result
- final ConfigTestAttributeConvert expected = new ConfigTestAttributeConvert();
- expected.setIntProp( 90 );
- expected.setIntegerProp( new Integer( -401 ) );
- assertEquals( expected, test );
- }
-
- /**
- * Tests setting an unknown attribute.
- */
- public void testSetUnknownAttribute()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- config.setAttribute( "unknown", "some value" );
-
- final ConfigTestEmpty test = new ConfigTestEmpty();
-
- // Configure the object
- try
- {
- m_configurer.configureElement( test, config, m_context );
- fail();
- }
- catch( final ConfigurationException ce )
- {
- final String message = REZ.getString( "no-such-attribute.error", "test", "unknown" );
- assertSameMessage( message, ce );
- }
- }
-
- /**
- * Tests setting a nested element, via adder and setter methods.
- */
- public void testSetElement()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- final DefaultConfiguration child1 = new DefaultConfiguration( "prop", "test" );
- final String value1 = "some value";
- child1.setAttribute( "some-prop", value1 );
- config.addChild( child1 );
- final DefaultConfiguration child2 = new DefaultConfiguration( "prop", "test" );
- final String value2 = "another value";
- child2.setAttribute( "some-prop", value2 );
- config.addChild( child2 );
-
- final ConfigTestSetElement test = new ConfigTestSetElement();
-
- // Configure the object
- configure( test, config );
-
- // Check result
- final ConfigTestSetElement expected = new ConfigTestSetElement();
- ConfigTestSetElement elem = new ConfigTestSetElement();
- elem.setSomeProp( value1 );
- expected.addProp( elem );
- elem = new ConfigTestSetElement();
- elem.setSomeProp( value2 );
- expected.addProp( elem );
- assertEquals( expected, test );
- }
-
- /**
- * Tests setting an unknown element.
- */
- public void testSetUnknownElement()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- final DefaultConfiguration elem = new DefaultConfiguration( "unknown", "test" );
- config.addChild( elem );
-
- final ConfigTestEmpty test = new ConfigTestEmpty();
-
- // Configure the object
- try
- {
- m_configurer.configureElement( test, config, m_context );
- fail();
- }
- catch( final ConfigurationException ce )
- {
- final String message = REZ.getString( "no-such-element.error", "test", "unknown" );
- assertSameMessage( message, ce );
- }
- }
-
- /**
- * Tests setting the content of an object.
- */
- public void testContent()
- throws Exception
- {
- // Create the test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- final String value1 = "some value";
- config.setValue( value1 );
-
- final ConfigTestContent test = new ConfigTestContent();
-
- // Configure the object
- configure( test, config );
-
- // Check result
- final ConfigTestContent expected = new ConfigTestContent();
- expected.addContent( value1 );
- assertEquals( expected, test );
- }
-
- /**
- * Tests setting the content of an object that does not handle it.
- */
- public void testUnexpectedContent()
- throws Exception
- {
- // Create the test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- config.setValue( "some value" );
-
- final ConfigTestEmpty test = new ConfigTestEmpty();
-
- // Configure the object
- try
- {
- m_configurer.configureElement( test, config, m_context );
- fail();
- }
- catch( final ConfigurationException ce )
- {
- final String message = REZ.getString( "no-content.error", "test" );
- assertSameMessage( message, ce );
- }
- }
-
- /**
- * Tests property resolution.
- */
- public void testPropResolution()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- config.setAttribute( "prop", "some ${prop-a} value" );
-
- final ConfigTestPropResolution test = new ConfigTestPropResolution();
-
- m_context.setProperty( "prop-a", "other" );
-
- // Configure the object
- configure( test, config );
-
- // Check the configured object
- final ConfigTestPropResolution expected = new ConfigTestPropResolution();
- expected.setProp( "some other value" );
- assertEquals( expected, test );
- }
-
- /**
- * Tests reference resolution via an attribute.
- */
- public void testReferenceAttribute() throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- config.setAttribute( "some-prop-ref", "prop-a" );
-
- final ConfigTestReferenceAttribute test = new ConfigTestReferenceAttribute();
-
- m_context.setProperty( "prop-a", "some value" );
-
- // Configure the object
- configure( test, config );
-
- // Check the configured object
- final ConfigTestReferenceAttribute expected = new ConfigTestReferenceAttribute();
- expected.setSomeProp( "some value" );
- assertEquals( expected, test );
- }
-
- /**
- * Tests reference resolution via a nested element.
- */
- public void testReferenceElement() throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- final DefaultConfiguration elem = new DefaultConfiguration( "some-prop-ref", "test" );
- elem.setAttribute( "id", "prop-a" );
- config.addChild( elem );
-
- final ConfigTestReferenceElement test = new ConfigTestReferenceElement();
-
- m_context.setProperty( "prop-a", "some value" );
-
- // Configure the object
- m_configurer.configureElement( test, config, m_context );
-
- // Check the configured object
- final ConfigTestReferenceElement expected = new ConfigTestReferenceElement();
- expected.addSomeProp( "some value" );
- assertEquals( expected, test );
- }
-
- /**
- * Tests that extra content is not allowed in a reference element.
- */
- public void testReferenceElementExtra()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- final DefaultConfiguration elem = new DefaultConfiguration( "some-prop-ref", "test" );
- elem.setAttribute( "id", "prop-a" );
- elem.setAttribute( "extra-attr", "some value" );
- config.addChild( elem );
-
- final ConfigTestReferenceElement test = new ConfigTestReferenceElement();
-
- try
- {
- // Configure the object
- m_configurer.configureElement( test, config, m_context );
- fail();
- }
- catch( ConfigurationException e )
- {
- final String[] messages = new String[]
- {
- REZ.getString( "bad-configure-element.error", "some-prop-ref" ),
- REZ.getString( "extra-config-for-ref.error" )
- };
- assertSameMessage( messages, e );
- }
- }
-
- /**
- * Tests reference type conversion.
- */
- public void testReferenceConversion() throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- config.setAttribute( "prop-a-ref", "id" );
-
- final Integer refValue = new Integer( 21 );
- m_context.setProperty( "id", refValue );
-
- registerConverter( ObjectToMyRole1Converter.class, Object.class, MyRole1.class );
-
- final ConfigTestReferenceConversion test = new ConfigTestReferenceConversion();
-
- // Configure
- configure( test, config );
-
- // Check result
- final ConfigTestReferenceConversion expected = new ConfigTestReferenceConversion();
- expected.setPropA( new MyRole1Adaptor( refValue ) );
- assertEquals( expected, test );
- }
-
- /**
- * Tests that the role's default type is used for interface typed
- * elements.
- */
- public void testInterfaceAdder()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- final DefaultConfiguration child = new DefaultConfiguration( "prop-a", "test" );
- config.addChild( child );
-
- registerRole( new RoleInfo( "myrole1", null, MyRole1.class, "default-type" ) );
- registerType( "myrole1", "default-type", MyType1.class );
-
- final ConfigTestInterfaceAdder test = new ConfigTestInterfaceAdder();
-
- // Configure object
- configure( test, config );
-
- // Check result
- final ConfigTestInterfaceAdder expected = new ConfigTestInterfaceAdder();
- expected.addPropA( new MyType1() );
- assertEquals( expected, test );
- }
-
- /**
- * Tests whether an object with a non-iterface typed adder causes an
- * exception.
- */
- public void testNonInterfaceTypedAdder()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
-
- final ConfigTestNonInterfaceAdder test = new ConfigTestNonInterfaceAdder();
-
- try
- {
- // Configure the object
- m_configurer.configureElement( test, config, m_context );
- fail();
- }
- catch( final ConfigurationException ce )
- {
- final String[] messages = {
- REZ.getString( "bad-configure-element.error", "test" ),
- REZ.getString( "typed-adder-non-interface.error",
- ConfigTestNonInterfaceAdder.class.getName(),
- Integer.class.getName() )
- };
- assertSameMessage( messages, ce );
- }
- }
-
- /**
- * Tests whether an object with multiple typed adders causes an exception.
- */
- public void testMultipleTypedAdder()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
-
- final ConfigTestMultipleTypedAdder test = new ConfigTestMultipleTypedAdder();
-
- try
- {
- // Configure the object
- m_configurer.configureElement( test, config, m_context );
- fail();
- }
- catch( final ConfigurationException ce )
- {
- final String[] messages = new String[]
- {
- REZ.getString( "bad-configure-element.error", "test" ),
- REZ.getString( "multiple-methods-for-element.error",
- ConfigTestMultipleTypedAdder.class.getName(),
- "add" )
- };
- assertSameMessage( messages, ce );
- }
- }
-
- /**
- * Tests to see if typed adder works, with iterface types.
- */
- public void testTypedAdder()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- final DefaultConfiguration child1 = new DefaultConfiguration( "my-type1", "test" );
- final DefaultConfiguration child2 = new DefaultConfiguration( "my-type2", "test" );
- config.addChild( child1 );
- config.addChild( child2 );
-
- registerRole( new RoleInfo( MyRole1.ROLE, "my-role1", MyRole1.class ) );
- registerType( MyRole1.ROLE, "my-type1", MyType1.class );
- registerType( MyRole1.ROLE, "my-type2", MyType2.class );
-
- final ConfigTestTypedAdder test = new ConfigTestTypedAdder();
-
- // Configure the object
- configure( test, config );
-
- final ConfigTestTypedAdder expected = new ConfigTestTypedAdder();
- expected.add( new MyType1() );
- expected.add( new MyType2() );
- assertEquals( expected, test );
- }
-
- /**
- * Tests to check that role is used for typed adder.
- */
- public void testTypedAdderRole()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- final DefaultConfiguration child1 = new DefaultConfiguration( "my-type1", "test" );
- config.addChild( child1 );
-
- // Register incompatible types with the same name, as data-type and myrole1.
- registerRole( new RoleInfo( "myrole1", "myrole1", MyRole1.class ) );
- registerType( "myrole1", "my-type1", MyType1.class );
- registerType( DataType.ROLE, "my-type1", StringBuffer.class );
-
- final ConfigTestTypedAdderRole test = new ConfigTestTypedAdderRole();
-
- // Configure the object
- configure( test, config );
-
- // Check the result
- final ConfigTestTypedAdderRole expected = new ConfigTestTypedAdderRole();
- expected.add( new MyType1() );
- assertEquals( expected, test );
- }
-
- /**
- * Tests conversion with a typed adder.
- */
- public void testTypedAdderConversion()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- final DefaultConfiguration child = new DefaultConfiguration( "some-type", "test" );
- child.setAttribute( "prop", "some value" );
- config.addChild( child );
-
- registerType( DataType.ROLE, "some-type", ConfigTestTypedAdderConversion.class );
- registerConverter( ObjectToMyRole1Converter.class, Object.class, MyRole1.class );
-
- final ConfigTestTypedAdderConversion test = new ConfigTestTypedAdderConversion();
-
- // Configure the object
- configure( test, config );
-
- // Check the result
- final ConfigTestTypedAdderConversion expected = new ConfigTestTypedAdderConversion();
- final ConfigTestTypedAdderConversion nested = new ConfigTestTypedAdderConversion();
- nested.setProp( "some value" );
- expected.add( new MyRole1Adaptor( nested ) );
- assertEquals( expected, test );
- }
-
- /**
- * Tests to see if typed adder works, with Configuration type.
- */
- public void testTypedConfigAdder()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- final DefaultConfiguration child1 = new DefaultConfiguration( "my-type1", "test" );
- final DefaultConfiguration child2 = new DefaultConfiguration( "my-type2", "test" );
- config.addChild( child1 );
- config.addChild( child2 );
-
- final ConfigTestTypedConfigAdder test = new ConfigTestTypedConfigAdder();
-
- // Configure the object
- configure( test, config );
-
- final ConfigTestTypedConfigAdder expected = new ConfigTestTypedConfigAdder();
- expected.add( child1 );
- expected.add( child2 );
- assertEquals( expected, test );
- }
-
- /**
- * Tests to see if adder works, with Configuration objects.
- */
- public void testConfigAdder()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- final DefaultConfiguration child1 = new DefaultConfiguration( "config", "test" );
- final DefaultConfiguration child2 = new DefaultConfiguration( "config", "test" );
- config.addChild( child1 );
- config.addChild( child2 );
-
- final ConfigTestConfigAdder test = new ConfigTestConfigAdder();
-
- // Configure the object
- configure( test, config );
-
- final ConfigTestConfigAdder expected = new ConfigTestConfigAdder();
- expected.addConfig( child1 );
- expected.addConfig( child2 );
- assertEquals( expected, test );
- }
-
- /**
- * Tests to check that Configurable is handled properly.
- */
- public void testConfigurable()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
-
- final ConfigTestConfigurable test = new ConfigTestConfigurable();
-
- // Configure the object
- m_configurer.configureElement( test, config, m_context );
-
- final ConfigTestConfigurable expected = new ConfigTestConfigurable();
- expected.configure( config );
- assertEquals( expected, test );
- }
-
- /**
- * Test resolving properties in an id.
- */
- public void testIdResolve()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- config.setAttribute( "some-prop-ref", "${id}" );
-
- final ConfigTestIdResolve test = new ConfigTestIdResolve();
-
- m_context.setProperty( "id", "prop-a" );
- m_context.setProperty( "prop-a", "some indirect value" );
-
- // Configure the object
- configure( test, config );
-
- // Check the configured object
- final ConfigTestIdResolve expected = new ConfigTestIdResolve();
- expected.setSomeProp( "some indirect value" );
- assertEquals( expected, test );
- }
-
- /**
- * Tests an unknown reference.
- */
- public void testUnknownReference()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- config.setAttribute( "some-prop-ref", "unknown-prop" );
-
- final ConfigTestUnknownReference test = new ConfigTestUnknownReference();
-
- // Configure the object
- try
- {
- m_configurer.configureElement( test, config, m_context );
- fail();
- }
- catch( ConfigurationException e )
- {
- final String[] messages = new String[]
- {
- REZ.getString( "bad-set-attribute.error", "test", "some-prop-ref" ),
- REZ.getString( "unknown-reference.error", "unknown-prop" )
- };
- assertSameMessage( messages, e );
- }
- }
-
- /**
- * Tests handling of mismatched reference type.
- */
- public void testMismatchedRefType()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- config.setAttribute( "some-prop-ref", "prop-a" );
-
- final ConfigTestMismatchedRefType test = new ConfigTestMismatchedRefType();
-
- m_context.setProperty( "prop-a", new Integer( 23 ) );
-
- // Configure the object
- try
- {
- m_configurer.configureElement( test, config, m_context );
- fail();
- }
- catch( ConfigurationException e )
- {
- final String[] messages = new String[]
- {
- REZ.getString( "bad-set-attribute.error", "test", "some-prop-ref" ),
- REZ.getString( "mismatch-ref-types.error",
- "prop-a",
- "some-prop" )
- };
- assertSameMessage( messages, e );
- }
- }
-
- /**
- * Tests using a reference with a typed adder. Tests using an attribute
- * and a nested element.
- */
- public void testTypedAdderReference()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- final DefaultConfiguration child = new DefaultConfiguration( "my-role1-ref", "test" );
- child.setAttribute( "id", "id2" );
- config.addChild( child );
-
- // Add role mapping, and add to reference to context
- registerRole( new RoleInfo( "my-role1", MyRole1.class ) );
- m_context.setProperty( "id2", new MyType2() );
-
- final ConfigTestTypedAdderReference test = new ConfigTestTypedAdderReference();
-
- // Configure the object
- configure( test, config );
-
- // Compare against expected value
- final ConfigTestTypedAdderReference expected = new ConfigTestTypedAdderReference();
- expected.add( new MyType2() );
- assertEquals( expected, test );
- }
-
- /**
- * Tests reporting of nested errors.
- */
- public void testNestedErrors() throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- final DefaultConfiguration elem = new DefaultConfiguration( "prop", "test" );
- elem.setAttribute( "not-a-prop", "not-a-value" );
- config.addChild( elem );
-
- final ConfigTestNestedErrors test = new ConfigTestNestedErrors();
-
- try
- {
- // Configure the object
- m_configurer.configureElement( test, config, m_context );
- fail();
- }
- catch( ConfigurationException e )
- {
- final String message = REZ.getString( "no-such-attribute.error",
- "prop",
- "not-a-prop" );
- assertSameMessage( message, e );
- }
- }
-
- /**
- * Tests that string setter/adder/creators are ignored when there
- * are multiple.
- */
- public void testIgnoreStringMethods()
- throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- config.setAttribute( "prop1", "some-value" );
- config.setValue( "99" );
- DefaultConfiguration elem = new DefaultConfiguration( "prop2", "test" );
- config.addChild( elem );
- elem = new DefaultConfiguration( "my-type1", "test" );
- config.addChild( elem );
-
- registerConverter( ObjectToMyRole1Converter.class, String.class, MyRole1.class );
- registerConverter( StringToIntegerConverter.class, String.class, Integer.class );
- registerType( DataType.ROLE, "my-type1", MyType1.class );
-
- final ConfigTestIgnoreStringMethods test = new ConfigTestIgnoreStringMethods();
-
- // Configure the object
- configure( test, config );
-
- // Test expected value
- final ConfigTestIgnoreStringMethods expected = new ConfigTestIgnoreStringMethods();
- expected.setProp1( new MyRole1Adaptor( "some-value" ) );
- expected.addProp2( new ConfigTestIgnoreStringMethods() );
- expected.add( new MyType1() );
- expected.addContent( 99 );
- assertEquals( expected, test );
- }
-
- /**
- * Tests that a class with a setter and adder with the same property name
- * is handled correctly.
- */
- public void testSetAndAdd() throws Exception
- {
- // Setup test data
- final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
- config.setAttribute( "prop", "some value" );
- DefaultConfiguration elem = new DefaultConfiguration( "prop", "test" );
- elem.setAttribute( "prop", "another value" );
- config.addChild( elem );
-
- final ConfigTestSetAndAdd test = new ConfigTestSetAndAdd();
-
- // Configure the object
- configure( test, config );
-
- // Test expected value
- final ConfigTestSetAndAdd expected = new ConfigTestSetAndAdd();
- expected.setProp( "some value" );
- final ConfigTestSetAndAdd nested = new ConfigTestSetAndAdd();
- nested.setProp( "another value" );
- expected.addProp( nested );
- assertEquals( expected, test );
- }
-
- private void configure( final Object test,
- final DefaultConfiguration config )
- throws ConfigurationException
- {
- try
- {
- m_configurer.configureElement( test, config, m_context );
- }
- catch( final ConfigurationException ce )
- {
- ExceptionUtil.printStackTrace( ce );
- throw ce;
- }
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/MyRole1.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/MyRole1.java
deleted file mode 100644
index c7dc8ae9e..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/MyRole1.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test;
-
-import org.apache.myrmidon.framework.DataType;
-
-/**
- * A basic interface to test configurer.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public interface MyRole1
- extends DataType
-{
- String ROLE = MyRole1.class.getName();
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/MyRole1Adaptor.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/MyRole1Adaptor.java
deleted file mode 100644
index 4c8f448d7..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/MyRole1Adaptor.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test;
-
-import org.apache.myrmidon.AbstractMyrmidonTest;
-import org.apache.myrmidon.components.configurer.test.MyRole1;
-
-/**
- * Adapts an Object to MyRole
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class MyRole1Adaptor
- implements MyRole1
-{
- private final Object m_object;
-
- public MyRole1Adaptor( final Object o )
- {
- m_object = o;
- }
-
- public boolean equals( Object obj )
- {
- final MyRole1Adaptor adaptor = (MyRole1Adaptor)obj;
- return AbstractMyrmidonTest.equals( m_object, adaptor.m_object );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/MyRole2.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/MyRole2.java
deleted file mode 100644
index e21a3ee95..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/MyRole2.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test;
-
-/**
- * A basic interface to test configurer.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public interface MyRole2
-{
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/MyType1.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/MyType1.java
deleted file mode 100644
index a0b6b7b70..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/MyType1.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test;
-
-import org.apache.myrmidon.components.configurer.test.MyRole1;
-
-/**
- * A basic implementation of MyRole1 to test configurer.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class MyType1
- implements MyRole1
-{
- public boolean equals( final Object object )
- {
- return object.getClass() == getClass();
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/MyType2.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/MyType2.java
deleted file mode 100644
index a605ddeed..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/MyType2.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test;
-
-import org.apache.myrmidon.components.configurer.test.MyRole1;
-
-/**
- * A basic implementation of MyRole1 to test configurer.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class MyType2
- implements MyRole1
-{
- public boolean equals( final Object object )
- {
- return object.getClass() == getClass();
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/ObjectToMyRole1Converter.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/ObjectToMyRole1Converter.java
deleted file mode 100644
index 06d74ea6e..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/ObjectToMyRole1Converter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test;
-
-import org.apache.aut.converter.AbstractConverter;
-import org.apache.aut.converter.ConverterException;
-import org.apache.myrmidon.components.configurer.test.MyRole1;
-import org.apache.myrmidon.components.configurer.test.MyRole1Adaptor;
-
-/**
- * Converts from Object to MyRole1.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class ObjectToMyRole1Converter
- extends AbstractConverter
-{
- public ObjectToMyRole1Converter()
- {
- super( Object.class, MyRole1.class );
- }
-
- protected Object convert( Object original, Object context )
- throws ConverterException
- {
- return new MyRole1Adaptor( original );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestAttributeConvert.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestAttributeConvert.java
deleted file mode 100644
index 840e6d43c..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestAttributeConvert.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import org.apache.myrmidon.components.AbstractComponentTest;
-
-/**
- * A class for testing conversion.
- *
- * @author Adam Murdoch
- */
-public class ConfigTestAttributeConvert
-{
- private int m_intProp;
- private Integer m_integerProp;
-
- public void setIntProp( final int intProp )
- {
- m_intProp = intProp;
- }
-
- public void setIntegerProp( final Integer integerProp )
- {
- m_integerProp = integerProp;
- }
-
- public boolean equals( Object obj )
- {
- ConfigTestAttributeConvert test = (ConfigTestAttributeConvert)obj;
- if( m_intProp != test.m_intProp )
- {
- return false;
- }
- if( !AbstractComponentTest.equals( m_integerProp, test.m_integerProp ) )
- {
- return false;
- }
-
- return true;
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestConfigAdder.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestConfigAdder.java
deleted file mode 100644
index 1568b4f28..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestConfigAdder.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.ArrayList;
-import org.apache.avalon.framework.configuration.Configuration;
-
-/**
- * Simple class to test adder for Configurations.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class ConfigTestConfigAdder
-{
- private ArrayList m_configurations = new ArrayList();
-
- public void addConfig( final Configuration configuration )
- {
- m_configurations.add( configuration );
- }
-
- public boolean equals( final Object object )
- {
- final ConfigTestConfigAdder other = (ConfigTestConfigAdder)object;
- return m_configurations.equals( other.m_configurations );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestContent.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestContent.java
deleted file mode 100644
index 0ab4e74c8..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestContent.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.myrmidon.framework.DataType;
-import org.apache.myrmidon.components.configurer.test.DefaultConfigurerTestCase;
-
-/**
- * A simple test class with string properties.
- *
- * @author Adam Murdoch
- */
-public class ConfigTestContent
- implements DataType
-{
- private String m_content;
-
- public boolean equals( final Object obj )
- {
- final ConfigTestContent test = (ConfigTestContent)obj;
- if( !DefaultConfigurerTestCase.equals( m_content, test.m_content ) )
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
- public void addContent( final String content )
- {
- m_content = content;
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestEmpty.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestEmpty.java
deleted file mode 100644
index 7438e1b6b..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestEmpty.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import org.apache.myrmidon.framework.DataType;
-
-/**
- * An empty class.
- *
- * @author Adam Murdoch
- */
-public class ConfigTestEmpty
- implements DataType
-{
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestIdResolve.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestIdResolve.java
deleted file mode 100644
index 22fe5d770..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestIdResolve.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.myrmidon.framework.DataType;
-import org.apache.myrmidon.components.configurer.test.DefaultConfigurerTestCase;
-
-/**
- * A simple test class with string properties.
- *
- * @author Adam Murdoch
- */
-public class ConfigTestIdResolve
- implements DataType
-{
- private String m_someProp;
-
- public boolean equals( final Object obj )
- {
- final ConfigTestIdResolve test = (ConfigTestIdResolve)obj;
- if( !DefaultConfigurerTestCase.equals( m_someProp, test.m_someProp ) )
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
- public void setSomeProp( final String value )
- {
- m_someProp = value;
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestIgnoreStringMethods.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestIgnoreStringMethods.java
deleted file mode 100644
index 9ecd3d688..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestIgnoreStringMethods.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.ArrayList;
-import junit.framework.AssertionFailedError;
-import org.apache.myrmidon.components.configurer.test.DefaultConfigurerTestCase;
-import org.apache.myrmidon.components.configurer.test.MyRole1;
-
-/**
- * A test class with multiple setters/adders/creators for a property.
- *
- * @author Adam Murdoch
- */
-public class ConfigTestIgnoreStringMethods
-{
- private MyRole1 m_prop1;
- private ArrayList m_prop2 = new ArrayList();
- private int m_content;
- private ArrayList m_typed = new ArrayList();
-
- public boolean equals( Object obj )
- {
- ConfigTestIgnoreStringMethods test = (ConfigTestIgnoreStringMethods)obj;
- if( !DefaultConfigurerTestCase.equals( m_prop1, test.m_prop1 ) )
- {
- return false;
- }
- if( !m_prop2.equals( test.m_prop2 ) )
- {
- return false;
- }
- if( m_content != test.m_content )
- {
- return false;
- }
- if( !m_typed.equals( test.m_typed ) )
- {
- return false;
- }
- return true;
- }
-
- //
- // Multiple Setters
- //
-
- public void setProp1( final String value )
- {
- throw new AssertionFailedError();
- }
-
- public void setProp1( final MyRole1 value )
- {
- m_prop1 = value;
- }
-
- //
- // Multiple Adders
- //
-
- public void addProp2( final String value )
- {
- throw new AssertionFailedError();
- }
-
- public void addProp2( final ConfigTestIgnoreStringMethods value )
- {
- m_prop2.add( value );
- }
-
- //
- // Multiple typed adders
- //
-
- public void add( final String value )
- {
- throw new AssertionFailedError();
- }
-
- public void add( final MyRole1 value )
- {
- m_typed.add( value );
- }
-
- //
- // Multiple content setters
- //
-
- public void addContent( final int value )
- {
- m_content = value;
- }
-
- public void addContent( final String value )
- {
- throw new AssertionFailedError();
- }
-
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestInterfaceAdder.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestInterfaceAdder.java
deleted file mode 100644
index e622b15af..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestInterfaceAdder.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.ArrayList;
-import org.apache.myrmidon.components.configurer.test.MyRole1;
-
-/**
- * A test class with an interface property.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class ConfigTestInterfaceAdder
-{
- private final ArrayList m_elems = new ArrayList();
-
- public void addPropA( final MyRole1 role1 )
- {
- m_elems.add( role1 );
- }
-
- public boolean equals( Object obj )
- {
- final ConfigTestInterfaceAdder test = (ConfigTestInterfaceAdder)obj;
- return m_elems.equals( test.m_elems );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestMismatchedRefType.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestMismatchedRefType.java
deleted file mode 100644
index 940465036..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestMismatchedRefType.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.myrmidon.framework.DataType;
-import org.apache.myrmidon.components.configurer.test.DefaultConfigurerTestCase;
-
-/**
- * A simple test class with string properties.
- *
- * @author Adam Murdoch
- */
-public class ConfigTestMismatchedRefType
- implements DataType
-{
- public void setSomeProp( final String value )
- {
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestMultipleTypedAdder.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestMultipleTypedAdder.java
deleted file mode 100644
index 256aed403..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestMultipleTypedAdder.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import org.apache.myrmidon.components.configurer.test.MyRole1;
-import org.apache.myrmidon.components.configurer.test.MyRole2;
-
-/**
- * Simple class with more than one typed adder method.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class ConfigTestMultipleTypedAdder
-{
- public void add( final MyRole1 role1 )
- {
- }
-
- public void add( final MyRole2 role2 )
- {
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestNestedErrors.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestNestedErrors.java
deleted file mode 100644
index e6f14a6d4..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestNestedErrors.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-/**
- * A simple test class.
- *
- * @author Adam Murdoch
- */
-public class ConfigTestNestedErrors
-{
- public void addProp( final ConfigTestEmpty test )
- {
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestNonInterfaceAdder.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestNonInterfaceAdder.java
deleted file mode 100644
index 432dd4e82..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestNonInterfaceAdder.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-/**
- * Simple class to test typed adder.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class ConfigTestNonInterfaceAdder
-{
- public void add( final Integer integer )
- {
- System.out.println( "This should not have been called as " +
- "Integer is not an interface" );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestPropResolution.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestPropResolution.java
deleted file mode 100644
index 48c729af0..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestPropResolution.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.List;
-import java.util.ArrayList;
-import org.apache.myrmidon.components.configurer.test.DefaultConfigurerTestCase;
-
-/**
- * Simple class to test typed adder.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class ConfigTestPropResolution
-{
- private String m_prop;
-
- public boolean equals( final Object obj )
- {
- final ConfigTestPropResolution test = (ConfigTestPropResolution)obj;
- if( !DefaultConfigurerTestCase.equals( m_prop, test.m_prop ) )
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
- public void setProp( final String value )
- {
- m_prop = value;
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestReferenceAttribute.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestReferenceAttribute.java
deleted file mode 100644
index 5946cdcd7..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestReferenceAttribute.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.List;
-import java.util.ArrayList;
-import org.apache.myrmidon.components.configurer.test.DefaultConfigurerTestCase;
-
-/**
- * Simple class to test typed adder.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class ConfigTestReferenceAttribute
-{
- private String m_someProp;
-
- public boolean equals( final Object obj )
- {
- final ConfigTestReferenceAttribute test = (ConfigTestReferenceAttribute)obj;
- if( !DefaultConfigurerTestCase.equals( m_someProp, test.m_someProp ) )
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
- public void setSomeProp( final String value )
- {
- m_someProp = value;
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestReferenceConversion.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestReferenceConversion.java
deleted file mode 100644
index 4862d3d78..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestReferenceConversion.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.ArrayList;
-import org.apache.myrmidon.components.configurer.test.MyRole1;
-
-/**
- * A simple test class.
- *
- * @author Adam Murdoch
- */
-public class ConfigTestReferenceConversion
-{
- private final ArrayList m_elems = new ArrayList();
-
- public void setPropA( final MyRole1 role1 )
- {
- m_elems.add( role1 );
- }
-
- public boolean equals( Object obj )
- {
- final ConfigTestReferenceConversion test = (ConfigTestReferenceConversion)obj;
- return m_elems.equals( test.m_elems );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestReferenceElement.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestReferenceElement.java
deleted file mode 100644
index d6d1cd007..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestReferenceElement.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.myrmidon.components.configurer.test.DefaultConfigurerTestCase;
-
-/**
- * A simple test class.
- *
- * @author Adam Murdoch
- */
-public class ConfigTestReferenceElement
-{
- private String m_someProp;
-
- public boolean equals( Object obj )
- {
- ConfigTestReferenceElement test = (ConfigTestReferenceElement)obj;
- if( !DefaultConfigurerTestCase.equals( m_someProp, test.m_someProp ) )
- {
- return false;
- }
- return true;
- }
-
- public void addSomeProp( final String value )
- {
- m_someProp = value;
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestSetAndAdd.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestSetAndAdd.java
deleted file mode 100644
index 68ebb1d7a..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestSetAndAdd.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.ArrayList;
-import org.apache.myrmidon.AbstractMyrmidonTest;
-
-/**
- * A test class with a setter and adder with the same property name.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class ConfigTestSetAndAdd
-{
- private String m_prop;
- private ArrayList m_nested = new ArrayList();
-
- public void setProp( final String prop )
- {
- m_prop = prop;
- }
-
- public void addProp( final ConfigTestSetAndAdd elem )
- {
- m_nested.add( elem );
- }
-
- public boolean equals( final Object obj )
- {
- ConfigTestSetAndAdd test = (ConfigTestSetAndAdd)obj;
- if( ! AbstractMyrmidonTest.equals( m_prop, test.m_prop) )
- {
- return false;
- }
- else if( ! m_nested.equals( test.m_nested ) )
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestSetAttribute.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestSetAttribute.java
deleted file mode 100644
index 4a933ef33..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestSetAttribute.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.List;
-import java.util.ArrayList;
-import org.apache.myrmidon.components.configurer.test.DefaultConfigurerTestCase;
-
-/**
- * Simple class to test setter.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class ConfigTestSetAttribute
-{
- private String m_someProp;
-
- public boolean equals( final Object obj )
- {
- final ConfigTestSetAttribute test = (ConfigTestSetAttribute)obj;
- if( !DefaultConfigurerTestCase.equals( m_someProp, test.m_someProp ) )
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
- public void setSomeProp( final String value )
- {
- m_someProp = value;
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestSetElement.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestSetElement.java
deleted file mode 100644
index d360a72ea..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestSetElement.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.myrmidon.components.configurer.test.DefaultConfigurerTestCase;
-
-/**
- * A simple test class.
- *
- * @author Adam Murdoch
- */
-public class ConfigTestSetElement
-{
- private List m_propList = new ArrayList();
- private String m_someProp;
-
- public boolean equals( Object obj )
- {
- ConfigTestSetElement test = (ConfigTestSetElement)obj;
- if( !m_propList.equals( test.m_propList ) )
- {
- return false;
- }
- else if( !DefaultConfigurerTestCase.equals( m_someProp, test.m_someProp ) )
- {
- return false;
- }
- return true;
- }
-
- public void setSomeProp( final String value )
- {
- m_someProp = value;
- }
-
- public void addProp( final ConfigTestSetElement test )
- {
- m_propList.add( test );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestTypedAdder.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestTypedAdder.java
deleted file mode 100644
index fdea6422b..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestTypedAdder.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.ArrayList;
-import org.apache.myrmidon.components.configurer.test.MyRole1;
-
-/**
- * Simple class to test adder for Configurations.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class ConfigTestTypedAdder
-{
- private ArrayList m_roles = new ArrayList();
-
- public void add( final MyRole1 role )
- {
- m_roles.add( role );
- }
-
- public boolean equals( final Object object )
- {
- final ConfigTestTypedAdder other = (ConfigTestTypedAdder)object;
- return m_roles.equals( other.m_roles );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestTypedAdderConversion.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestTypedAdderConversion.java
deleted file mode 100644
index 0aeb29d9b..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestTypedAdderConversion.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.ArrayList;
-import org.apache.myrmidon.components.configurer.test.MyRole1;
-import org.apache.myrmidon.framework.DataType;
-
-/**
- * Simple class to test typed adder.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class ConfigTestTypedAdderConversion
- implements DataType
-{
- private ArrayList m_roles = new ArrayList();
- private String m_prop;
-
- public void setProp( final String prop )
- {
- m_prop = prop;
- }
- public void add( final MyRole1 role1 )
- {
- m_roles.add( role1 );
- }
-
- public boolean equals( final Object object )
- {
- final ConfigTestTypedAdderConversion other = (ConfigTestTypedAdderConversion)object;
- return m_roles.equals( other.m_roles );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestTypedAdderReference.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestTypedAdderReference.java
deleted file mode 100644
index 6ce6bc078..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestTypedAdderReference.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.ArrayList;
-import org.apache.myrmidon.components.configurer.test.MyRole1;
-
-/**
- * Simple class to test typed adder.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class ConfigTestTypedAdderReference
-{
- private ArrayList m_roles = new ArrayList();
-
- public void add( final MyRole1 role1 )
- {
- m_roles.add( role1 );
- }
-
- public boolean equals( final Object object )
- {
- final ConfigTestTypedAdderReference other = (ConfigTestTypedAdderReference)object;
- return m_roles.equals( other.m_roles );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestTypedAdderRole.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestTypedAdderRole.java
deleted file mode 100644
index d8ac8d59e..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestTypedAdderRole.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.ArrayList;
-import org.apache.myrmidon.components.configurer.test.MyRole1;
-
-/**
- * Simple class to test typed adder.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class ConfigTestTypedAdderRole
-{
- private ArrayList m_roles = new ArrayList();
-
- public void add( final MyRole1 role1 )
- {
- m_roles.add( role1 );
- }
-
- public boolean equals( final Object object )
- {
- final ConfigTestTypedAdderRole other = (ConfigTestTypedAdderRole)object;
- return m_roles.equals( other.m_roles );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestTypedConfigAdder.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestTypedConfigAdder.java
deleted file mode 100644
index 2d7bcf02d..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestTypedConfigAdder.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import java.util.ArrayList;
-import org.apache.avalon.framework.configuration.Configuration;
-
-/**
- * Simple class to test adder for Configurations.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class ConfigTestTypedConfigAdder
-{
- private ArrayList m_configurations = new ArrayList();
-
- public void add( final Configuration configuration )
- {
- m_configurations.add( configuration );
- }
-
- public boolean equals( final Object object )
- {
- final ConfigTestTypedConfigAdder other = (ConfigTestTypedConfigAdder)object;
- return m_configurations.equals( other.m_configurations );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestUnknownReference.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestUnknownReference.java
deleted file mode 100644
index d304f1c4c..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/test/data/ConfigTestUnknownReference.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.configurer.test.data;
-
-import org.apache.myrmidon.framework.DataType;
-
-/**
- * A simple test class with string properties.
- *
- * @author Adam Murdoch
- */
-public class ConfigTestUnknownReference
- implements DataType
-{
- public void setSomeProp( final String value )
- {
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/DefaultDeployerTestCase.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/DefaultDeployerTestCase.java
deleted file mode 100644
index 37247aea9..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/DefaultDeployerTestCase.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.deployer.test;
-
-import java.io.File;
-import org.apache.aut.converter.Converter;
-import org.apache.aut.converter.ConverterException;
-import org.apache.myrmidon.components.AbstractComponentTest;
-import org.apache.myrmidon.components.deployer.DefaultDeployer;
-import org.apache.myrmidon.framework.DataType;
-import org.apache.myrmidon.interfaces.deployer.ConverterDefinition;
-import org.apache.myrmidon.interfaces.deployer.Deployer;
-import org.apache.myrmidon.interfaces.deployer.TypeDefinition;
-import org.apache.myrmidon.interfaces.deployer.TypeDeployer;
-import org.apache.myrmidon.interfaces.type.TypeException;
-import org.apache.myrmidon.interfaces.type.TypeFactory;
-
-/**
- * Test cases for the default deployer.
- *
- * @author Adam Murdoch
- */
-public class DefaultDeployerTestCase
- extends AbstractComponentTest
-{
- private static final String TEST_TYPE1_NAME = "test-type1";
-
- private Deployer m_deployer;
- private Converter m_converter;
-
- public DefaultDeployerTestCase( final String name )
- {
- super( name );
- }
-
- /**
- * Setup the test case - prepares the set of components, including the
- * deployer.
- */
- protected void setUp() throws Exception
- {
- super.setUp();
- m_deployer = (Deployer)getServiceManager().lookup( Deployer.ROLE );
- m_converter = (Converter)getServiceManager().lookup( Converter.ROLE );
- }
-
- /**
- * Creates an instance of a component. Sub-classes can override this
- * method to add a particular implementation to the set of test components.
- */
- protected Object createComponent( final String role, final Class defaultImpl )
- throws Exception
- {
- if( role.equals( Deployer.ROLE) )
- {
- return new DefaultDeployer();
- }
- else
- {
- return super.createComponent( role, defaultImpl );
- }
- }
-
- /**
- * Tests deployment of a single type from a ClassLoader.
- */
- public void testSingleType() throws Exception
- {
- final String typeName = TEST_TYPE1_NAME;
- final String classname = TestType1.class.getName();
-
- // Determine the shorthand for the DataType role
-
- // Create the type definition
- final TypeDefinition typeDef = new TypeDefinition( typeName, DATA_TYPE_ROLE, classname );
-
- final ClassLoader classLoader = getClass().getClassLoader();
- final TypeDeployer typeDeployer = m_deployer.createDeployer( classLoader );
-
- // Make sure the test types have not been deployed
- assertTypesNotRegistered();
-
- // Deploy the type
- typeDeployer.deployType( typeDef );
-
- // Check the type has been registered
- final TypeFactory typeFactory = getTypeManager().getFactory( DataType.ROLE );
- final Object result = typeFactory.create( typeName );
- assertTrue( result instanceof TestType1 );
- }
-
- /**
- * Tests deployment of a single converter from a ClassLoader.
- */
- public void testSingleConverter() throws Exception
- {
- // Create the type definition
- final String classname = TestConverter1.class.getName();
- final String source = "java.lang.String";
- final String destClass = TestType1.class.getName();
-
- final ConverterDefinition typeDef =
- new ConverterDefinition( classname, source, destClass );
-
- final ClassLoader classLoader = getClass().getClassLoader();
- final TypeDeployer typeDeployer = m_deployer.createDeployer( classLoader );
-
- // Make sure the test types have not been deployed
- assertTypesNotRegistered();
-
- // Deploy the type
- typeDeployer.deployType( typeDef );
-
- // Try to convert from string to test type
- final Object result = m_converter.convert( TestType1.class, "some-string", null );
- assertTrue( result instanceof TestType1 );
- }
-
- /**
- * Tests deployment of types from a typelib descriptor.
- */
- public void testLibDescriptor() throws Exception
- {
- final File typelib = getTestResource( "test.atl" );
- final TypeDeployer typeDeployer = m_deployer.createDeployer( typelib );
-
- // Make sure the test types have not been deployed
- assertTypesNotRegistered();
-
- // Deploy all the types from the descriptor
- typeDeployer.deployAll();
-
- // Make sure the test types have been deployed
- assertTypesRegistered();
- }
-
- /**
- * Ensures that the test types have not ben deployed.
- */
- private void assertTypesNotRegistered() throws Exception
- {
- // Check the data-type
- TypeFactory typeFactory = getTypeManager().getFactory( DataType.ROLE );
- try
- {
- typeFactory.create( TEST_TYPE1_NAME );
- fail();
- }
- catch( TypeException e )
- {
- // TODO - check error message
- }
-
- // Check the custom role implementation
- try
- {
- typeFactory = getTypeManager().getFactory( TestRole1.ROLE );
- typeFactory.create( TEST_TYPE1_NAME );
- fail();
- }
- catch( TypeException e )
- {
- // TODO - check error message
- }
-
- // Check the converter
- try
- {
- m_converter.convert( TestType1.class, "some string", null );
- fail();
- }
- catch( ConverterException e )
- {
- // TODO - check error message
- }
- }
-
- /**
- * Ensures the types from the test typelib descriptor have been correctly
- * deployed.
- */
- private void assertTypesRegistered() throws Exception
- {
- // Check the data-type
- TypeFactory typeFactory = getTypeManager().getFactory( DataType.ROLE );
- Object object = typeFactory.create( TEST_TYPE1_NAME );
- assertTrue( object instanceof TestType1 );
-
- // Check the custom role implementation
- typeFactory = getTypeManager().getFactory( TestRole1.ROLE );
- object = typeFactory.create( TEST_TYPE1_NAME );
- assertTrue( object instanceof TestType1 );
-
- // Check the converter
- object = m_converter.convert( TestType1.class, "some string", null );
- assertTrue( object instanceof TestType1 );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/TestConverter1.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/TestConverter1.java
deleted file mode 100644
index af61edaa2..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/TestConverter1.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.deployer.test;
-
-import org.apache.aut.converter.Converter;
-import org.apache.aut.converter.ConverterException;
-
-/**
- * A test converter.
- *
- * @author Adam Murdoch
- */
-public class TestConverter1
- implements Converter
-{
- /**
- * Convert original to destination type.
- */
- public Object convert( Class destination, Object original, Object context )
- throws ConverterException
- {
- return new TestType1();
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/TestRole1.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/TestRole1.java
deleted file mode 100644
index 60fc79166..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/TestRole1.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.deployer.test;
-
-/**
- * A test role interface.
- *
- * @author Adam Murdoch
- */
-public interface TestRole1
-{
- String ROLE = TestRole1.class.getName();
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/TestType1.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/TestType1.java
deleted file mode 100644
index 7cf53f163..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/TestType1.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.deployer.test;
-
-import org.apache.myrmidon.framework.DataType;
-import org.apache.myrmidon.components.deployer.test.TestRole1;
-
-/**
- * A test data-type.
- *
- * @author Adam Murdoch
- */
-public class TestType1
- implements DataType, TestRole1
-{
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/ant-descriptor.xml b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/ant-descriptor.xml
deleted file mode 100644
index 43d07cd67..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/ant-descriptor.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/ant-roles.xml b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/ant-roles.xml
deleted file mode 100644
index 86e6070ec..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/deployer/test/ant-roles.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/embeddor/test/DefaultEmbeddorTest.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/embeddor/test/DefaultEmbeddorTest.java
deleted file mode 100644
index 20d971643..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/embeddor/test/DefaultEmbeddorTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.embeddor.test;
-
-import java.io.File;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.myrmidon.AbstractProjectTest;
-import org.apache.myrmidon.LogMessageTracker;
-import org.apache.myrmidon.interfaces.embeddor.Embeddor;
-import org.apache.myrmidon.interfaces.model.Project;
-import org.apache.myrmidon.interfaces.model.Target;
-import org.apache.myrmidon.interfaces.workspace.Workspace;
-import org.apache.myrmidon.listeners.ProjectListener;
-
-/**
- * Test cases for the default embeddor.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class DefaultEmbeddorTest
- extends AbstractProjectTest
-{
- public DefaultEmbeddorTest( String name )
- {
- super( name );
- }
-
- /**
- * Tests that a project is successfully built from a file.
- */
- public void testProjectBuilder() throws Exception
- {
- // Build the project
- final File projectFile = getTestResource( "project-builder.ant" );
- final Project project = getEmbeddor().createProject( projectFile.getAbsolutePath(), null, null );
-
- // Verify the project.
- assertEquals( "test-project", project.getProjectName() );
- assertEquals( "main-target", project.getDefaultTargetName() );
- assertEquals( projectFile.getParentFile(), project.getBaseDirectory() );
- assertEquals( 0, project.getProjectNames().length );
- assertEquals( 0, project.getTypeLibs().length );
- assertEquals( 1, project.getTargetNames().length );
-
- final Target implicitTarget = project.getImplicitTarget();
- assertEquals( 1, implicitTarget.getTasks().length );
- assertEquals( "property", implicitTarget.getTasks()[ 0 ].getName() );
-
- final Target target = project.getTarget( "main-target" );
- assertEquals( 1, target.getTasks().length );
- assertEquals( "log", target.getTasks()[ 0 ].getName() );
- }
-
- /**
- * Tests that a listener can be created.
- */
- public void testCreateListener() throws Exception
- {
- final ProjectListener listener = getEmbeddor().createListener( "default" );
- }
-
- /**
- * Tests that a workspace can execute a project file.
- */
- public void testWorkspaceCreate() throws Exception
- {
- // Build the project
- final File projectFile = getTestResource( "project-builder.ant" );
- final Embeddor embeddor = getEmbeddor();
- final Project project = embeddor.createProject( projectFile.getAbsolutePath(), null, null );
-
- // Build the workspace
- final Workspace workspace = embeddor.createWorkspace( new Parameters() );
-
- // Install a listener
- final LogMessageTracker listener = new LogMessageTracker();
- workspace.addProjectListener( listener );
-
- listener.addExpectedMessage( "main-target", "A log message" );
-
- // Execute the default target
- final String target = project.getDefaultTargetName();
- workspace.executeProject( project, target );
-
- // Cleanup
- listener.assertComplete();
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/embeddor/test/project-builder.ant b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/embeddor/test/project-builder.ant
deleted file mode 100644
index 7f52d2702..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/embeddor/test/project-builder.ant
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- A log message
-
-
\ No newline at end of file
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/property/test/AbstractPropertyResolverTestCase.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/property/test/AbstractPropertyResolverTestCase.java
deleted file mode 100644
index ad00470b6..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/property/test/AbstractPropertyResolverTestCase.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.property.test;
-
-import java.io.File;
-import java.util.Date;
-import org.apache.antlib.core.ObjectToStringConverter;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.components.AbstractComponentTest;
-import org.apache.myrmidon.components.workspace.DefaultTaskContext;
-import org.apache.myrmidon.interfaces.property.PropertyResolver;
-
-/**
- * General-purpose property resolver test cases.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public abstract class AbstractPropertyResolverTestCase
- extends AbstractComponentTest
-{
- protected final static Resources REZ = getResourcesForTested( AbstractPropertyResolverTestCase.class );
-
- protected PropertyResolver m_resolver;
- protected DefaultTaskContext m_context;
-
- public AbstractPropertyResolverTestCase( final String name )
- {
- super( name );
- }
-
- protected void setUp() throws Exception
- {
- m_resolver = (PropertyResolver)getServiceManager().lookup( PropertyResolver.ROLE );
-
- m_context = new DefaultTaskContext( null, null, getLogger() );
- m_context.setProperty( "intProp", new Integer( 333 ) );
- m_context.setProperty( "stringProp", "String property" );
-
- registerConverter( ObjectToStringConverter.class, Object.class, String.class );
- }
-
- /**
- * Creates an instance of a component. Sub-classes can override this
- * method to add a particular implementation to the set of test components.
- */
- protected Object createComponent( String role, Class defaultImpl )
- throws Exception
- {
- if( role.equals( PropertyResolver.ROLE) )
- {
- return createResolver();
- }
- else
- {
- return super.createComponent( role, defaultImpl );
- }
- }
-
- /**
- * Creates the resolver to test.
- */
- protected abstract PropertyResolver createResolver();
-
- /**
- * Test property resolution with various different typed properties.
- */
- public void testPropertyTypes() throws Exception
- {
- testPropertyValue( new String( "String value" ) );
- testPropertyValue( new Date() );
- testPropertyValue( new Integer( Integer.MIN_VALUE ) );
- testPropertyValue( new Double( 24234.98453 ) );
- testPropertyValue( this.getClass() );
- testPropertyValue( File.createTempFile( "PropertyResolverTest", null ) );
- }
-
- /**
- * Simple tests with property on it's own, and accompanied by text.
- */
- private void testPropertyValue( final Object propObject )
- throws Exception
- {
- m_context.setProperty( "typedProp", propObject );
- final String propString = propObject.toString();
-
- doTestResolution( "${typedProp}", propObject, m_context );
- doTestResolution( "${typedProp} with following text",
- propString + " with following text", m_context );
- doTestResolution( "Preceding text with ${typedProp}",
- "Preceding text with " + propString, m_context );
- }
-
- /**
- * Tests multiple property declarations in a single value.
- */
- public void testMultipleProperties() throws Exception
- {
- m_context.setProperty( "prop1", "value1" );
- m_context.setProperty( "prop2", "value2" );
- m_context.setProperty( "int1", new Integer( 123 ) );
-
- doTestResolution( "${prop1}${prop2}", "value1value2", m_context );
- doTestResolution( "${prop1}${prop1}${prop1}", "value1value1value1", m_context );
- doTestResolution( "before ${prop2} between ${prop1} after",
- "before value2 between value1 after", m_context );
- doTestResolution( "${prop1}-${int1}-${prop2}", "value1-123-value2", m_context );
- }
-
- /**
- * Tests illegal property syntax.
- */
- public void testInvalidTypeDeclarations() throws Exception
- {
-
- doTestFailure( "${unclosed",
- REZ.getString( "prop.mismatched-braces.error" ),
- m_context );
- doTestFailure( "${",
- REZ.getString( "prop.mismatched-braces.error" ),
- m_context );
-
- /* TODO - need to handle these cases. */
- // testFailure( "${bad${}", "", m_context );
- // testFailure( "${ }", "", m_context );
- }
-
- /**
- * Resolves the property using the supplied context, and checks the result.
- */
- protected void doTestResolution( final String value,
- final Object expected,
- final TaskContext context )
- throws Exception
- {
- final Object resolved = m_resolver.resolveProperties( value, context );
-
- assertEquals( expected, resolved );
- }
-
- /**
- * Attempts to resolve the value using the supplied context, expecting to
- * fail with the supplied error message.
- */
- protected void doTestFailure( final String value,
- final String expectedErrorMessage,
- final TaskContext context )
- {
- try
- {
- m_resolver.resolveProperties( value, context );
- fail( "Unexpected sucess - test should have failed." );
- }
- catch( TaskException e )
- {
- assertSameMessage( expectedErrorMessage, e );
- }
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/property/test/ClassicPropertyResolverTestCase.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/property/test/ClassicPropertyResolverTestCase.java
deleted file mode 100644
index 12eef075a..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/property/test/ClassicPropertyResolverTestCase.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.property.test;
-
-import org.apache.myrmidon.interfaces.property.PropertyResolver;
-import org.apache.myrmidon.components.property.test.AbstractPropertyResolverTestCase;
-import org.apache.myrmidon.components.property.ClassicPropertyResolver;
-
-/**
- * A test for {@link org.apache.myrmidon.components.property.ClassicPropertyResolver}.
- *
- * @author Darrell DeBoer
- * @version $Revision$ $Date$
- */
-public class ClassicPropertyResolverTestCase
- extends AbstractPropertyResolverTestCase
-{
- public ClassicPropertyResolverTestCase( String name )
- {
- super( name );
- }
-
- protected PropertyResolver createResolver()
- {
- return new ClassicPropertyResolver();
- }
-
- /**
- * Tests handing undefined property.
- */
- public void testUndefinedProp() throws Exception
- {
- final String undefinedProp = "undefinedProperty";
- final String propRef = "${" + undefinedProp + "}";
- doTestResolution( propRef, propRef, m_context );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/property/test/DefaultPropertyResolverTestCase.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/property/test/DefaultPropertyResolverTestCase.java
deleted file mode 100644
index 0183adea8..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/property/test/DefaultPropertyResolverTestCase.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.property.test;
-
-import org.apache.myrmidon.interfaces.property.PropertyResolver;
-import org.apache.myrmidon.components.property.test.AbstractPropertyResolverTestCase;
-import org.apache.myrmidon.components.property.DefaultPropertyResolver;
-
-/**
- * Functional tests for {@link org.apache.myrmidon.components.property.DefaultPropertyResolver}.
- *
- * @author Darrell DeBoer
- * @version $Revision$ $Date$
- */
-public class DefaultPropertyResolverTestCase
- extends AbstractPropertyResolverTestCase
-{
- public DefaultPropertyResolverTestCase( final String name )
- {
- super( name );
- }
-
- protected PropertyResolver createResolver()
- {
- return new DefaultPropertyResolver();
- }
-
- /**
- * Tests handing undefined property.
- */
- public void testUndefinedProp() throws Exception
- {
- final String undefinedProp = "undefinedProperty";
- doTestFailure( "${" + undefinedProp + "}",
- REZ.getString( "prop.missing-value.error", undefinedProp ),
- m_context );
-
- //TODO - "" should be disallowed as a property name
- doTestFailure( "${}",
- REZ.getString( "prop.missing-value.error", "" ),
- m_context );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/role/test/DefaultRoleManagerTestCase.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/role/test/DefaultRoleManagerTestCase.java
deleted file mode 100644
index ba68eb68c..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/role/test/DefaultRoleManagerTestCase.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.role.test;
-
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.myrmidon.AbstractMyrmidonTest;
-import org.apache.myrmidon.components.role.DefaultRoleManager;
-import org.apache.myrmidon.api.Task;
-import org.apache.myrmidon.interfaces.role.RoleException;
-import org.apache.myrmidon.interfaces.role.RoleInfo;
-import org.apache.myrmidon.interfaces.role.RoleManager;
-
-/**
- * Test cases for the DefaultRoleManager.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class DefaultRoleManagerTestCase
- extends AbstractMyrmidonTest
-{
- private final static Resources REZ = getResourcesForTested( DefaultRoleManagerTestCase.class );
-
- private RoleManager m_roleManager;
-
- public DefaultRoleManagerTestCase( String name )
- {
- super( name );
- }
-
- protected void setUp() throws Exception
- {
- m_roleManager = new DefaultRoleManager();
- }
-
- /**
- * Tests looking up a role by name, shorthand and type.
- */
- public void testLookup() throws Exception
- {
- final String roleName = "role-name";
- final String shorthand = "role-shorthand";
- final RoleInfo origRole = new RoleInfo( roleName, shorthand, Task.class );
- m_roleManager.addRole( origRole );
-
- // Lookup the role
- RoleInfo role = m_roleManager.getRole( roleName );
- assertTrue( origRole.equals( role ) );
-
- // Lookup the role by shorthand
- role = m_roleManager.getRoleByShorthandName( shorthand );
- assertTrue( origRole.equals( role ) );
-
- // Lookup the role by type
- role = m_roleManager.getRoleByType( Task.class );
- assertTrue( origRole.equals( role ) );
-
- // Lookup an unknown role
- RoleInfo unknownRole = m_roleManager.getRole( "unknown" );
- assertNull( unknownRole );
-
- // Lookup an unknown shorthand
- unknownRole = m_roleManager.getRoleByShorthandName( "unknown" );
- assertNull( unknownRole );
-
- // Lookup an unknown role
- unknownRole = m_roleManager.getRoleByType( DefaultRoleManagerTestCase.class );
- assertNull( unknownRole );
- }
-
- /**
- * Tests inheriting roles from parent role manager.
- */
- public void testParent() throws Exception
- {
- final String roleName = "role-name";
- final String shorthand = "shorthand";
- final RoleInfo origRole = new RoleInfo( roleName, shorthand, Task.class );
- m_roleManager.addRole( origRole );
- final RoleManager roleManager = new DefaultRoleManager( m_roleManager );
-
- // Lookup by name
- RoleInfo roleInfo = roleManager.getRole( roleName );
- assertTrue( origRole.equals( roleInfo ) );
-
- // Lookup by shorthand
- roleInfo = roleManager.getRoleByShorthandName( shorthand );
- assertTrue( origRole.equals( roleInfo ) );
-
- // Lookup by type
- roleInfo = roleManager.getRoleByType( Task.class );
- assertTrue( origRole.equals( roleInfo ) );
- }
-
- /**
- * Tests overriding a role in a child role manager.
- */
- public void testOverrideName() throws Exception
- {
- final String roleName = "role-name";
- final String shorthand = "shorthand";
-
- // Add original role
- final RoleInfo origRole = new RoleInfo( roleName, shorthand, Task.class );
- m_roleManager.addRole( origRole );
-
- // Override role
- final RoleManager roleManager = new DefaultRoleManager( m_roleManager );
- final RoleInfo overrideNameRole = new RoleInfo( roleName, "shorthand1" );
- roleManager.addRole( overrideNameRole );
- final RoleInfo overrideShorthandRole = new RoleInfo( "role2", shorthand );
- roleManager.addRole( overrideShorthandRole );
- final RoleInfo overrideTypeRole = new RoleInfo( "role3", "shorthand3", Task.class );
- roleManager.addRole( overrideTypeRole );
-
- // Lookup role by name
- RoleInfo roleInfo = roleManager.getRole( roleName );
- assertTrue( overrideNameRole.equals( roleInfo ) );
-
- // Lookup role by shorthand
- roleInfo = roleManager.getRoleByShorthandName( shorthand );
- assertTrue( overrideShorthandRole.equals( roleInfo ) );
-
- // Lookup role by type
- roleInfo = roleManager.getRoleByType( Task.class );
- assertTrue( overrideTypeRole.equals( roleInfo ) );
- }
-
- /**
- * Tests adding duplicate roles.
- */
- public void testDuplicate() throws Exception
- {
- final String roleName = "role-name";
- final String shorthand = "shorthand";
- final RoleInfo origRole = new RoleInfo( roleName, shorthand, Task.class );
- m_roleManager.addRole( origRole );
-
- // Duplicate role name
- try
- {
- m_roleManager.addRole( new RoleInfo( roleName ) );
- fail();
- }
- catch( RoleException exc )
- {
- final String message = REZ.getString( "duplicate-role.error", roleName );
- assertSameMessage( message, exc );
- }
-
- // Duplicate shorthand
- try
- {
- m_roleManager.addRole( new RoleInfo( "another-role", shorthand ) );
- fail();
- }
- catch( RoleException exc )
- {
- final String message = REZ.getString( "duplicate-shorthand.error", shorthand );
- assertSameMessage( message, exc );
- }
-
- // Duplicate type
- try
- {
- m_roleManager.addRole( new RoleInfo( null, Task.class ) );
- fail();
- }
- catch( RoleException exc )
- {
- final String message = REZ.getString( "duplicate-type.error", Task.class.getName() );
- assertSameMessage( message, exc );
- }
- }
-
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/InstantiatingServiceManagerTestCase.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/InstantiatingServiceManagerTestCase.java
deleted file mode 100644
index 932978376..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/InstantiatingServiceManagerTestCase.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.service.test;
-
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.myrmidon.components.AbstractComponentTest;
-import org.apache.myrmidon.components.service.InstantiatingServiceManager;
-import org.apache.myrmidon.interfaces.role.RoleInfo;
-import org.apache.myrmidon.interfaces.role.RoleManager;
-import org.apache.myrmidon.interfaces.service.ServiceFactory;
-import org.apache.myrmidon.interfaces.type.DefaultTypeFactory;
-import org.apache.myrmidon.interfaces.type.TypeManager;
-
-/**
- * Test cases for the default service manager.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class InstantiatingServiceManagerTestCase
- extends AbstractComponentTest
-{
- private final static Resources REZ = getResourcesForTested( InstantiatingServiceManagerTestCase.class );
-
- private InstantiatingServiceManager m_serviceManager;
- private Parameters m_parameters = new Parameters();
-
- public InstantiatingServiceManagerTestCase( final String name )
- {
- super( name );
- }
-
- /**
- * Setup the test case - prepares the set of components.
- */
- protected void setUp()
- throws Exception
- {
- // Set-up the service manager
- m_serviceManager = new InstantiatingServiceManager();
- m_serviceManager.enableLogging( getLogger() );
- m_serviceManager.service( getServiceManager() );
- m_serviceManager.parameterize( m_parameters );
- }
-
- /**
- * Tests service instantiation.
- */
- public void testCreateService() throws Exception
- {
- final String serviceRoleName = "test-service";
-
- // Setup the test service
- registerFactory( serviceRoleName, TestService.class, TestServiceFactory1.class );
-
- // Create the service
- Object service = m_serviceManager.lookup( serviceRoleName );
-
- // Check service is of the expected class (don't use instanceof)
- assertTrue( service.getClass() == TestServiceImpl1.class );
- }
-
- /**
- * Tests service lookup.
- */
- public void testLookup() throws Exception
- {
- final String serviceRoleName = "test-service";
-
- // Setup the test service
- registerFactory( serviceRoleName, TestService.class, TestServiceFactory1.class );
-
- // Check whether the service can be instantiated
- boolean hasService = m_serviceManager.hasService( serviceRoleName );
- assertTrue( hasService );
- }
-
- /**
- * Tests that a service factory and service instance are taken through
- * the lifecycle steps.
- */
- public void testLifecycle() throws Exception
- {
- final String serviceRoleName = "test-service";
-
- // Setup the test service
- registerFactory( serviceRoleName, TestService.class, TestServiceFactory2.class );
-
- // Create the service
- TestService service = (TestService)m_serviceManager.lookup( serviceRoleName );
-
- // Check service is of the expected class (don't use instanceof)
- assertTrue( service.getClass() == TestServiceImpl2.class );
-
- // Assert the service has been setup correctly
- service.doWork();
- }
-
- /**
- * Tests looking up an unknown service.
- */
- public void testUnknownService() throws Exception
- {
- // Make sure that hasService() works correctly
- final String serviceRole = "some-unknown-service";
- assertTrue( !m_serviceManager.hasService( serviceRole ) );
-
- // Make sure that lookup() fails
- try
- {
- m_serviceManager.lookup( serviceRole );
- fail();
- }
- catch( ServiceException e )
- {
- final String message = REZ.getString( "create-service.error", serviceRole );
- assertSameMessage( message, e );
- }
- }
-
- /**
- * Registers a service factory.
- */
- private void registerFactory( final String serviceRoleName,
- final Class serviceType,
- final Class factoryClass )
- throws Exception
- {
- // TODO - add stuff to TypeDeployer to do this instead
- final RoleManager roleManager = (RoleManager)getServiceManager().lookup( RoleManager.ROLE );
- roleManager.addRole( new RoleInfo( serviceRoleName, null, serviceType ) );
- final DefaultTypeFactory typeFactory = new DefaultTypeFactory( getClass().getClassLoader() );
- typeFactory.addNameClassMapping( serviceRoleName, factoryClass.getName() );
- final TypeManager typeManager = (TypeManager)getServiceManager().lookup( TypeManager.ROLE );
- typeManager.registerType( ServiceFactory.ROLE, serviceRoleName, typeFactory );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/LifecycleValidator.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/LifecycleValidator.java
deleted file mode 100644
index b95ac5ffe..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/LifecycleValidator.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.service.test;
-
-import junit.framework.Assert;
-import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.logger.LogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.parameters.ParameterException;
-import org.apache.avalon.framework.parameters.Parameterizable;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-
-/**
- * A basic class that asserts that the object is correctly set-up.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class LifecycleValidator
- extends Assert
- implements LogEnabled, Serviceable, Parameterizable, Initializable
-{
- private String m_state = STATE_NOT_INIT;
-
- private final static String STATE_NOT_INIT = "not-prepared";
- private final static String STATE_LOG_ENABLED = "log-enabled";
- private final static String STATE_SERVICED = "serviced";
- private final static String STATE_PARAMETERISED = "parameterised";
- protected final static String STATE_INITIALISED = "initialised";
-
- public void enableLogging( final Logger logger )
- {
- assertEquals( STATE_NOT_INIT, m_state );
- m_state = STATE_LOG_ENABLED;
- }
-
- public void service( final ServiceManager serviceManager ) throws ServiceException
- {
- assertEquals( STATE_LOG_ENABLED, m_state );
- m_state = STATE_SERVICED;
- }
-
- public void parameterize( Parameters parameters ) throws ParameterException
- {
- assertEquals( STATE_SERVICED, m_state );
- m_state = STATE_PARAMETERISED;
- }
-
- public void initialize() throws Exception
- {
- assertEquals( STATE_PARAMETERISED, m_state );
- m_state = STATE_INITIALISED;
- }
-
- protected void assertSetup()
- {
- assertEquals( STATE_INITIALISED, m_state );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/TestService.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/TestService.java
deleted file mode 100644
index 302c2a5b3..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/TestService.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.service.test;
-
-/**
- * A service interface.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public interface TestService
-{
- void doWork();
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/TestServiceFactory1.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/TestServiceFactory1.java
deleted file mode 100644
index 10e0f69bc..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/TestServiceFactory1.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.service.test;
-
-import org.apache.myrmidon.interfaces.service.AntServiceException;
-import org.apache.myrmidon.interfaces.service.ServiceFactory;
-
-/**
- * A test service factory.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class TestServiceFactory1
- implements ServiceFactory
-{
- /**
- * Create a service that coresponds to this factory.
- */
- public Object createService()
- throws AntServiceException
- {
- return new TestServiceImpl1();
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/TestServiceFactory2.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/TestServiceFactory2.java
deleted file mode 100644
index 524d3cc04..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/TestServiceFactory2.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.service.test;
-
-import org.apache.myrmidon.interfaces.service.AntServiceException;
-import org.apache.myrmidon.interfaces.service.ServiceFactory;
-import org.apache.myrmidon.components.service.test.LifecycleValidator;
-
-/**
- * A test service factory, which asserts that the factory has been properly
- * set-up before it is used.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class TestServiceFactory2
- extends LifecycleValidator
- implements ServiceFactory
-{
- /**
- * Create a service that corresponds to this factory.
- */
- public Object createService()
- throws AntServiceException
- {
- assertSetup();
- return new TestServiceImpl2();
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/TestServiceImpl1.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/TestServiceImpl1.java
deleted file mode 100644
index c22e4d0a7..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/TestServiceImpl1.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.service.test;
-
-import org.apache.myrmidon.components.service.test.TestService;
-
-/**
- * A test service implementation.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class TestServiceImpl1
- implements TestService
-{
- public void doWork()
- {
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/TestServiceImpl2.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/TestServiceImpl2.java
deleted file mode 100644
index 933d76383..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/service/test/TestServiceImpl2.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.components.service.test;
-
-import org.apache.myrmidon.components.service.test.LifecycleValidator;
-import org.apache.myrmidon.components.service.test.TestService;
-
-/**
- * A test service that asserts it has been set-up correctly.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class TestServiceImpl2
- extends LifecycleValidator
- implements TestService
-{
- public void doWork()
- {
- assertSetup();
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/framework/file/test/PathTestCase.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/framework/file/test/PathTestCase.java
deleted file mode 100644
index 36b391051..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/framework/file/test/PathTestCase.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.framework.file.test;
-
-import java.io.File;
-import org.apache.avalon.excalibur.io.FileUtil;
-import org.apache.myrmidon.AbstractProjectTest;
-import org.apache.myrmidon.LogMessageTracker;
-
-/**
- * Test-cases for the data type.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- */
-public class PathTestCase
- extends AbstractProjectTest
-{
- public PathTestCase( final String name )
- {
- super( name );
- }
-
- /**
- * Tests setting the location attribute.
- */
- public void testLocationAttribute() throws Exception
- {
- testPathContent( "set-location", new String[] { "location" } );
- }
-
- /**
- * Tests setting the path attribute.
- */
- public void testPathAttribute() throws Exception
- {
- // Test a path with a single file
- testPathContent( "set-path", new String[] { "single-file" } );
-
- // Test a path with several files, using ; separator
- testPathContent( "set-multi-path", new String[] { "file1", "file2", ".." } );
-
- // Test a path with several files, using : separator
- testPathContent( "set-multi-path2", new String[] { "file1", "file2", ".." } );
- }
-
- /**
- * Test using nested elements.
- */
- public void testPathElement() throws Exception
- {
- testPathContent( "nested-path", new String[] { "some-file" } );
- testPathContent( "mixed-path", new String[] { "file1", "file2", "file3", "file4", "file5" } );
- }
-
- /**
- * Test using nested elements.
- */
- public void testFilesetElement() throws Exception
- {
- testPathContent( "set-fileset", new String[] { "path.ant" } );
- }
-
- /**
- * Test using a nested custom file list implementation.
- */
- public void testCustomFileList() throws Exception
- {
- testPathContent( "test-custom-file-list", new String[] { "file1" } );
- }
-
- /**
- * Executes a target, and asserts that a particular list of file names
- * is logged.
- */
- private void testPathContent( final String targetName,
- final String[] files ) throws Exception
- {
- final File projectFile = getTestResource( "path.ant" );
- final File baseDir = projectFile.getParentFile();
-
- // Add each of the expected file names
- final LogMessageTracker listener = new LogMessageTracker();
- for( int i = 0; i < files.length; i++ )
- {
- final String fileName = files[ i ];
- final File file = FileUtil.resolveFile( baseDir, fileName );
- listener.addExpectedMessage( targetName, file.getAbsolutePath() );
- }
-
- // Execute the target
- executeTarget( projectFile, targetName, listener );
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/framework/file/test/TestFileList.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/framework/file/test/TestFileList.java
deleted file mode 100644
index c5984de5b..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/framework/file/test/TestFileList.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.framework.file.test;
-
-import org.apache.myrmidon.framework.file.FileList;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.myrmidon.api.TaskException;
-import java.io.File;
-
-/**
- * A test FileList implementation.
- *
- * @author Adam Murdoch
- * @version $Revision$ $Date$
- *
- * @ant:type type="path" name="test-file-list"
- */
-public class TestFileList
- implements FileList
-{
- private String m_name;
-
- public void setName( final String name )
- {
- m_name = name;
- }
-
- /**
- * Returns the files in this list.
- */
- public String[] listFiles( final TaskContext context )
- throws TaskException
- {
- final File file = context.resolveFile( m_name );
- return new String[] { file.getAbsolutePath() };
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/framework/file/test/path.ant b/proposal/myrmidon/src/testcases/org/apache/myrmidon/framework/file/test/path.ant
deleted file mode 100644
index 319f92336..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/framework/file/test/path.ant
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/interfaces/model/test/DefaultNameValidatorTestCase.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/interfaces/model/test/DefaultNameValidatorTestCase.java
deleted file mode 100644
index ff3368e19..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/interfaces/model/test/DefaultNameValidatorTestCase.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.interfaces.model.test;
-
-import org.apache.myrmidon.AbstractMyrmidonTest;
-import org.apache.myrmidon.interfaces.model.DefaultNameValidator;
-
-/**
- * TestCases for {@link org.apache.myrmidon.interfaces.model.DefaultNameValidator}.
- *
- * @author Darrell DeBoer
- * @version $Revision$ $Date$
- */
-public class DefaultNameValidatorTestCase
- extends AbstractMyrmidonTest
-{
- private DefaultNameValidator m_validator = new DefaultNameValidator();
-
- public DefaultNameValidatorTestCase( String name )
- {
- super( name );
- }
-
- /**
- * Test valid names for the default validator.
- */
- public void testValidNames() throws Exception
- {
- testValid( "aName" );
- testValid( "123456" );
- testValid( "s p a ce s" );
- testValid( "d-a-s-h-e-s-" );
- testValid( "d.o.t.s." );
- testValid( "_u_n_d_e_r_s_c_o_r_e_s" );
- testValid( "a" );
- testValid( "1" );
- testValid( "_" );
-
- }
-
- /**
- * Test invalid names for the default validator.
- */
- public void testInvalidNames() throws Exception
- {
- testInvalid( "" );
- testInvalid( " " );
- testInvalid( " " );
- testInvalid( " bad" );
- testInvalid( "bad " );
- testInvalid( " bad " );
- testInvalid( "-dashfirst" );
- testInvalid( ".dotfirst" );
- testInvalid( "question?" );
- }
-
- /**
- * Test that certain characters are disallowed in the default validator.
- */
- public void testReservedChars() throws Exception
- {
- String reserved = "!@#$%^&*()+=~`{}[]|\\/?<>,:;";
-
- for( int pos = 0; pos < reserved.length(); pos++ )
- {
- char chr = reserved.charAt( pos );
- testReservedChar( chr );
- }
- }
-
- private void testReservedChar( char chr ) throws Exception
- {
- String test = "a" + String.valueOf( chr );
- testInvalid( test );
- }
-
- /**
- * Test validation using a restrictive set of validation rules.
- */
- public void testStrictNames() throws Exception
- {
- m_validator = new DefaultNameValidator( false, false, "", false, false, "." );
-
- testValid( "name" );
- testValid( "a" );
- testValid( "yep.ok" );
-
- testInvalid( "_nogood" );
- testInvalid( "no_good" );
- testInvalid( "nope1" );
- testInvalid( "123" );
- testInvalid( "not ok" );
- }
-
- private void testValid( String name )
- {
- try
- {
- m_validator.validate( name );
- }
- catch( Exception e )
- {
- fail( e.getMessage() );
- }
- }
-
- private void testInvalid( String name )
- {
- try
- {
- m_validator.validate( name );
- fail( "Name \"" + name + "\" should be invalid." );
- }
- catch( Exception e )
- {
- }
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/interfaces/type/test/MyType1.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/interfaces/type/test/MyType1.java
deleted file mode 100644
index 226b9a3bb..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/interfaces/type/test/MyType1.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.interfaces.type.test;
-
-/**
- * A basic implementation of a type to test the type factory.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class MyType1
-{
- public boolean equals( final Object object )
- {
- return object.getClass() == getClass();
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/interfaces/type/test/MyType2.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/interfaces/type/test/MyType2.java
deleted file mode 100644
index a9418f1ae..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/interfaces/type/test/MyType2.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.interfaces.type.test;
-
-/**
- * A basic implementation of a type to test the type factory.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class MyType2
-{
- public boolean equals( final Object object )
- {
- return object.getClass() == getClass();
- }
-}
diff --git a/proposal/myrmidon/src/testcases/org/apache/myrmidon/interfaces/type/test/TypeFactoryTestCase.java b/proposal/myrmidon/src/testcases/org/apache/myrmidon/interfaces/type/test/TypeFactoryTestCase.java
deleted file mode 100644
index 62ed33a88..000000000
--- a/proposal/myrmidon/src/testcases/org/apache/myrmidon/interfaces/type/test/TypeFactoryTestCase.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.myrmidon.interfaces.type.test;
-
-import java.io.File;
-import java.net.URL;
-import org.apache.myrmidon.AbstractMyrmidonTest;
-import org.apache.myrmidon.interfaces.type.DefaultTypeFactory;
-import org.apache.myrmidon.interfaces.type.ReloadingTypeFactory;
-import org.apache.myrmidon.interfaces.type.TypeException;
-
-/**
- * These are unit tests that test the basic operation of TypeFactories.
- *
- * @author Peter Donald
- * @version $Revision$ $Date$
- */
-public class TypeFactoryTestCase
- extends AbstractMyrmidonTest
-{
- private final static String TYPE_NAME1 = "my-type1";
- private final static String TYPE_NAME2 = "my-type2";
- private final static Class TYPE_CLASS1 = MyType1.class;
- private final static Class TYPE_CLASS2 = MyType2.class;
- private final static String TYPE_CLASSNAME1 = TYPE_CLASS1.getName();
- private final static String TYPE_CLASSNAME2 = TYPE_CLASS2.getName();
-
- public TypeFactoryTestCase( final String name )
- {
- super( name );
- }
-
- /**
- * Make sure that you can load a basic type from DefaultTypeManager.
- */
- public void testBasicType()
- {
- final ClassLoader classLoader = getClass().getClassLoader();
- final DefaultTypeFactory factory = new DefaultTypeFactory( classLoader );
- factory.addNameClassMapping( TYPE_NAME2, TYPE_CLASSNAME2 );
-
- try
- {
- final Object type = factory.create( TYPE_NAME2 );
- final Class typeClass = type.getClass();
- assertEquals( "The type loaded for factory should be same class as in current classloader",
- typeClass, TYPE_CLASS2 );
- }
- catch( TypeException e )
- {
- fail( "Unable to create Type due to " + e );
- }
- }
-
- /**
- * Make sure that when you load a type from a RelaodableTypeFactory
- * that it is actually reloaded.
- */
- public void testReloadingTypeFactory()
- throws Exception
- {
- final File file = getTestResource( "types.jar" );
- final URL[] classpath = new URL[]{file.toURL()};
- final ReloadingTypeFactory factory = new ReloadingTypeFactory( classpath, null );
- factory.addNameClassMapping( TYPE_NAME1, TYPE_CLASSNAME1 );
-
- try
- {
- final Object type = factory.create( TYPE_NAME1 );
- final Class typeClass = type.getClass();
- final boolean sameClass = typeClass == TYPE_CLASS1;
- assertTrue( "The type loaded for factory should not be same class as in current classloader",
- !sameClass );
- }
- catch( TypeException e )
- {
- fail( "Unable to create Type due to " + e );
- }
- }
-}