You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by bl...@apache.org on 2003/06/25 14:15:24 UTC
cvs commit: avalon-sandbox/csframework/src/test/Configuration AbstractConfigurationTestCase.cs DefaultConfigurationTestCase.cs
bloritsch 2003/06/25 05:15:23
Modified: csframework AvalonFramework.build GETTING-STARTED.txt
Added: csframework/src/test AssemblyInfo.cs
csframework/src/test/Configuration
AbstractConfigurationTestCase.cs
DefaultConfigurationTestCase.cs
Log:
add one test case, more to come, and initial support for ndocs (equiv. to JavaDocs)--not working
Revision Changes Path
1.4 +65 -3 avalon-sandbox/csframework/AvalonFramework.build
Index: AvalonFramework.build
===================================================================
RCS file: /home/cvs/avalon-sandbox/csframework/AvalonFramework.build,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AvalonFramework.build 24 Jun 2003 21:16:06 -0000 1.3
+++ AvalonFramework.build 25 Jun 2003 12:15:23 -0000 1.4
@@ -3,6 +3,7 @@
<property name="version" value="1.0"/>
<property name="library.name" value="${name}-${version}"/>
<property name="build.debug" value="true"/>
+ <property name="build.dir" value="build"/>
<target name="build" description="Build the AvalonFramework dll">
<csc target="library"
@@ -18,9 +19,70 @@
</csc>
</target>
+ <target name="build-test" depends="build">
+ <sysinfo/>
+ <csc target="library"
+ output="${library.name}-test.dll"
+ debug="${build.debug}">
+ <references>
+ <includes name="*.dll"/>
+ <includes name="bin/*.dll"/>
+ <includes name="${sys.env.NANT_HOME}/bin/nunit.framework.dll"/>
+ </references>
+ <sources basedir="src/test">
+ <includes name="Configuration/*.cs"/>
+ </sources>
+ </csc>
+ </target>
+
+ <target name="test" depends="build-test" description="Run the NUnit tests">
+ <nunit2 haltonfailure="true">
+ <test assemblyname="${library.name}-test.dll"/>
+ </nunit2>
+ </target>
+
+ <target name="ndocs" depends="build" description="Build the API documentation">
+ <ndoc verbose="true">
+ <assemblies>
+ <includes name="${library.name}.dll"/>
+ </assemblies>
+ <summaries>
+ <includes name="NamespaceSummary.xml"/>
+ </summaries>
+ <documenters>
+ <documenter name="MSDN">
+ <property name="OutputDirectory" value="doc\MSDN" />
+ <property name="HtmlHelpName" value="AvalonFramework" />
+ <property name="HtmlHelpCompilerFilename" value="hhc.exe" />
+ <property name="IncludeFavorites" value="False" />
+ <property name="Title" value="The Avalon Framework API Docs" />
+ <property name="SplitTOCs" value="False" />
+ <property name="DefaulTOC" value="" />
+ <property name="ShowMissingSummaries" value="True" />
+ <property name="ShowMissingRemarks" value="True" />
+ <property name="ShowMissingParams" value="True" />
+ <property name="ShowMissingReturns" value="True" />
+ <property name="ShowMissingValues" value="True" />
+ <property name="DocumentInternals" value="False" />
+ <property name="DocumentProtected" value="True" />
+ <property name="DocumentPrivates" value="False" />
+ <property name="DocumentEmptyNamespaces" value="False" />
+ <property name="IncludeAssemblyVersion" value="False" />
+ <property name="CopyrightText" value="" />
+ <property name="CopyrightHref" value="" />
+ </documenter>
+ </documenters>
+ </ndoc>
+ </target>
+
<target name="clean" description="Clean up after ourselves">
- <delete file="${library.name}.pdb"/>
- <delete file="${library.name}.dll"/>
- <delete file="${library.name}.xml"/>
+ <delete>
+ <fileset>
+ <includes name="*.pdb"/>
+ <includes name="*.dll"/>
+ <includes name="*.xml"/>
+ <includes name="doc"/>
+ </fileset>
+ </delete>
</target>
</project>
1.2 +3 -0 avalon-sandbox/csframework/GETTING-STARTED.txt
Index: GETTING-STARTED.txt
===================================================================
RCS file: /home/cvs/avalon-sandbox/csframework/GETTING-STARTED.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GETTING-STARTED.txt 24 Jun 2003 17:34:52 -0000 1.1
+++ GETTING-STARTED.txt 25 Jun 2003 12:15:23 -0000 1.2
@@ -18,3 +18,6 @@
to build the Avalon project.
+This build script expects you to define the environment
+variable %NANT_HOME% so that it can find the NUnit dll.
+
1.1 avalon-sandbox/csframework/src/test/AssemblyInfo.cs
Index: AssemblyInfo.cs
===================================================================
// ============================================================================
// The Apache Software License, Version 1.1
// ============================================================================
//
// Copyright (C) 2002-2003 The Apache Software Foundation. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. The end-user documentation included with the redistribution, if any, must
// include the following acknowledgment: "This product includes software
// developed by the Apache Software Foundation (http://www.apache.org/)."
// Alternately, this acknowledgment may appear in the software itself, if
// and wherever such third-party acknowledgments normally appear.
//
// 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
// must not be used to endorse or promote products derived from this software
// without prior written permission. For written permission, please contact
// apache@apache.org.
//
// 5. Products derived from this software may not be called "Apache", nor may
// "Apache" appear in their name, without prior written permission of the
// Apache Software Foundation.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// This software consists of voluntary contributions made by many individuals
// on behalf of the Apache Software Foundation. For more information on the
// Apache Software Foundation, please see <http://www.apache.org/>.
// ============================================================================
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("AvalonFramework")]
[assembly: AssemblyDescription("Avalon Framework defines the lifecycle interfaces and contracts that all components must obey.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Apache Software Foundation")]
[assembly: AssemblyProduct("Avalon Framework")]
[assembly: AssemblyCopyright("Copyright (c) 2002 Apache Software Foundation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
1.1 avalon-sandbox/csframework/src/test/Configuration/AbstractConfigurationTestCase.cs
Index: AbstractConfigurationTestCase.cs
===================================================================
// ============================================================================
// The Apache Software License, Version 1.1
// ============================================================================
//
// Copyright (C) 2002-2003 The Apache Software Foundation. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. The end-user documentation included with the redistribution, if any, must
// include the following acknowledgment: "This product includes software
// developed by the Apache Software Foundation (http://www.apache.org/)."
// Alternately, this acknowledgment may appear in the software itself, if
// and wherever such third-party acknowledgments normally appear.
//
// 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
// must not be used to endorse or promote products derived from this software
// without prior written permission. For written permission, please contact
// apache@apache.org.
//
// 5. Products derived from this software may not be called "Apache", nor may
// "Apache" appear in their name, without prior written permission of the
// Apache Software Foundation.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// This software consists of voluntary contributions made by many individuals
// on behalf of the Apache Software Foundation. For more information on the
// Apache Software Foundation, please see <http://www.apache.org/>.
// ============================================================================
using System;
using System.Collections;
using Apache.Avalon.Framework.Util;
using NUnit.Framework;
namespace Apache.Avalon.Framework.Configuration
{
public abstract class AbstractConfigurationTest
{
protected abstract AbstractConfiguration GetConfiguration();
[Test]
public void IsReadOnly()
{
AbstractConfiguration config = GetConfiguration();
Assertion.AssertEquals( false, config.IsReadOnly );
config.MakeReadOnly();
Assertion.AssertEquals( true, config.IsReadOnly );
}
[Test]
public void Name()
{
AbstractConfiguration config = GetConfiguration();
config.Name = "Name";
Assertion.AssertEquals( "Name", config.Name );
}
[Test]
public void Location()
{
AbstractConfiguration config = GetConfiguration();
config.Location = "Location";
Assertion.AssertEquals( "Location", config.Location );
}
[Test]
public void Value()
{
AbstractConfiguration config = GetConfiguration();
config.Value = "Value";
Assertion.AssertEquals( "Value", config.Value );
}
[Test]
public void Namespace()
{
AbstractConfiguration config = GetConfiguration();
config.Namespace = "Namespace";
Assertion.AssertEquals( "Namespace", config.Namespace );
}
[Test]
public void Prefix()
{
AbstractConfiguration config = GetConfiguration();
config.Prefix = "Prefix";
Assertion.AssertEquals( "Prefix", config.Prefix );
}
[Test]
public void Children()
{
AbstractConfiguration config = GetConfiguration();
Assertion.AssertNotNull( config.Children );
ConfigurationCollection collection = config.Children;
for (int i = 0; i < 10; i++)
{
AbstractConfiguration child = GetConfiguration();
child.Name="Child" + i;
collection.Add( child );
}
config.Children = collection;
Assertion.AssertEquals( 10, config.Children.Count );
int x = 0;
foreach ( AbstractConfiguration child in config.Children )
{
Assertion.Equals( "Child" + x, child.Name );
x++;
}
}
/// <summary>
/// Gets node attributes.
/// </summary>
/// <value>
/// All attributes of the node.
/// </value>
/* public IDictionary Attributes
{
get
{
if (attributes == null)
{
attributes = new Hashtable();
}
return attributes;
}
set
{
CheckReadOnly();
attributes = new Hashtable(value);
}
}
/// <summary>
/// Gets a <see cref="Apache.Avalon.Framework.Configuration.AbstractConfiguration"/> instance encapsulating the specified
/// child node.
/// </summary>
/// <param name="child">The Name of the child node.</param>
/// <returns>
/// The <see cref="Apache.Avalon.Framework.Configuration.AbstractConfiguration"/> instance encapsulating the specified
/// child node.
/// </returns>
public AbstractConfiguration GetChild(string child)
{
return GetChild(child, false);
}
/// <summary>
/// Gets a <see cref="Apache.Avalon.Framework.Configuration.AbstractConfiguration"/> instance encapsulating the specified
/// child node.
/// </summary>
/// <param name="child">The Name of the child node.</param>
/// <param name="createNew">
/// If <see langword="true"/>, a new <see cref="Apache.Avalon.Framework.Configuration.AbstractConfiguration"/>
/// will be created and returned if the specified child does not exist.
/// If <see langword="false"/>, <see langword="null"/> will be returned when the specified
/// child doesn't exist.
/// </param>
/// <returns>
/// The <see cref="Apache.Avalon.Framework.Configuration.AbstractConfiguration"/> instance encapsulating the specified
/// child node.
/// </returns>
public abstract AbstractConfiguration GetChild(string child, bool createNew);
/// <summary>
/// Return an <see cref="ConfigurationCollection"/> of <see cref="AbstractConfiguration"/>
/// elements containing all node children with the specified name.
/// </summary>
/// <param name="name">The Name of the children to get.</param>
/// <returns>
/// All node children with the specified name
/// </returns>
public abstract ConfigurationCollection GetChildren(string name);
/// <summary>
/// Gets the value of the node and converts it
/// into specified <see cref="System.Type"/>.
/// </summary>
/// <param name="type">The <see cref="System.Type"/></param>
/// <returns>The Value converted into the specified type.</returns>
/// <exception cref="InvalidCastException">
/// If the convertion fails, an exception will be thrown.
/// </exception>
public object GetValue(Type type)
{
return GetValue(type, null);
}
/// <summary>
/// Gets the value of the node and converts it
/// into specified <see cref="System.Type"/>.
/// </summary>
/// <param name="type">The <see cref="System.Type"/></param>
/// <param name="defaultValue">
/// The Default value returned if the convertion fails.
/// </param>
/// <returns>The Value converted into the specified type.</returns>
public object GetValue(Type type, object defaultValue)
{
return Converter.ChangeType(Value, type, defaultValue);
}
/// <summary>
/// Gets the value of specified attribute and
/// converts it into specified <see cref="System.Type"/>.
/// </summary>
/// <param name="name">The Name of the attribute you ask the value of.</param>
/// <param name="type">The <see cref="System.Type"/></param>
/// <returns>The Value converted into the specified type.</returns>
/// <exception cref="InvalidCastException">
/// If the convertion fails, an exception will be thrown.
/// </exception>
public object GetAttribute(string name, Type type)
{
return GetAttribute(name, type, null);
}
/// <summary>
/// Gets the value of specified attribute and
/// converts it into specified <see cref="System.Type"/>.
/// </summary>
/// <param name="name">The Name of the attribute you ask the value of.</param>
/// <param name="type">The <see cref="System.Type"/></param>
/// <param name="defaultValue">
/// The Default value returned if the convertion fails.
/// </param>
/// <returns>The Value converted into the specified type.</returns>
public object GetAttribute(string name, Type type, object defaultValue)
{
return Converter.ChangeType(Attributes[name], type, defaultValue);
}
*/
}
}
1.1 avalon-sandbox/csframework/src/test/Configuration/DefaultConfigurationTestCase.cs
Index: DefaultConfigurationTestCase.cs
===================================================================
// ============================================================================
// The Apache Software License, Version 1.1
// ============================================================================
//
// Copyright (C) 2002-2003 The Apache Software Foundation. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. The end-user documentation included with the redistribution, if any, must
// include the following acknowledgment: "This product includes software
// developed by the Apache Software Foundation (http://www.apache.org/)."
// Alternately, this acknowledgment may appear in the software itself, if
// and wherever such third-party acknowledgments normally appear.
//
// 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
// must not be used to endorse or promote products derived from this software
// without prior written permission. For written permission, please contact
// apache@apache.org.
//
// 5. Products derived from this software may not be called "Apache", nor may
// "Apache" appear in their name, without prior written permission of the
// Apache Software Foundation.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// This software consists of voluntary contributions made by many individuals
// on behalf of the Apache Software Foundation. For more information on the
// Apache Software Foundation, please see <http://www.apache.org/>.
// ============================================================================
using System;
using System.Collections;
using System.Runtime.Serialization;
using Apache.Avalon.Framework.Util;
using NUnit.Framework;
namespace Apache.Avalon.Framework.Configuration
{
[TestFixture]
public class DefaultConfigurationTest: AbstractConfigurationTest
{
protected override AbstractConfiguration GetConfiguration()
{
return new DefaultConfiguration("Name", "Location", "Namespace", "Prefix");
}
/*
public override IConfiguration GetChild(string name, bool createNew )
{
IConfiguration result = null;
if (Children.Count != 0)
{
foreach (IConfiguration configuration in Children)
{
if (string.Compare(configuration.Name, name) == 0)
{
result = configuration;
break;
}
}
}
else
{
if( createNew )
{
result = new DefaultConfiguration( name, string.Empty );
}
}
return result;
}
/// <summary>
/// Return a collection of <see cref="IConfiguration"/>
/// elements containing all node children with the specified name.
/// </summary>
/// <param name="name">The Name of the children to get.</param>
/// <returns>
/// The collection of <see cref="IConfiguration"/> children of
/// this associated with the given name.
/// </returns>
public override ConfigurationCollection GetChildren(string name)
{
ConfigurationCollection result = new ConfigurationCollection();
foreach (IConfiguration configuration in Children)
{
if (string.Compare(configuration.Name, name) == 0)
{
result.Add(configuration);
}
}
return result;
}
/// <summary>
/// Populates a <see cref="SerializationInfo"/> with the data needed
/// to serialize the target object.
/// </summary>
/// <param name="info">The <see cref="SerializationInfo"/> to populate with data.</param>
/// <param name="context">The destination for this serialization.</param>
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue(SERIAL_NAME_NAME, Name);
info.AddValue(SERIAL_NAME_LOCATION, Location);
info.AddValue(SERIAL_NAME_NAMESPACE, Namespace);
info.AddValue(SERIAL_NAME_PREFIX, Prefix);
info.AddValue(SERIAL_NAME_VALUE, Value);
info.AddValue(SERIAL_NAME_READ_ONLY, IsReadOnly);
RuntimeSerializer.SerializeIDictionary(info, Attributes,
SERIAL_NAME_ATTRIBUTE_KEYS, SERIAL_NAME_ATTRIBUTE_VALUES);
RuntimeSerializer.SerializeICollection(info, Children, SERIAL_NAME_CHILDREN);
}*/
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org