avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: avalon-sandbox/csframework/src/test ServiceExceptionTestCase.cs ContextExceptionTestCase.cs DefaultContextTestCase.cs ParameterExceptionTestCase.cs
Date Fri, 01 Aug 2003 13:42:09 GMT
bloritsch    2003/08/01 06:42:09

  Modified:    csframework/src/cs ContainerUtil.cs ILoggable.cs cs.csproj
               csframework/src/test ServiceExceptionTestCase.cs
  Added:       csframework/src/cs IInitializable.cs IStartable.cs
                        ISuspendable.cs
  Removed:     csframework/src/cs ParameterException.cs
               csframework/src/test ContextExceptionTestCase.cs
                        DefaultContextTestCase.cs
                        ParameterExceptionTestCase.cs
  Log:
  update with the remaining interfaces and fix the tests
  
  Revision  Changes    Path
  1.2       +17 -80    avalon-sandbox/csframework/src/cs/ContainerUtil.cs
  
  Index: ContainerUtil.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/csframework/src/cs/ContainerUtil.cs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ContainerUtil.cs	27 Jun 2003 20:52:02 -0000	1.1
  +++ ContainerUtil.cs	1 Aug 2003 13:42:09 -0000	1.2
  @@ -56,7 +56,7 @@
   	/// </summary>
   	public class ContainerUtil
   	{
  -/*		/// <summary>
  +		/// <summary>
   		/// Runs specified object through shutdown lifecycle stages
   		/// (Stop and Dispose).
   		/// </summary>
  @@ -95,64 +95,35 @@
   		}
   
   		/// <summary>
  -		/// Supplies specified object with a <see cref="IContext"/> object if it implements
the
  -		/// <see cref="IContextualizable"/> interface.
  -		/// </summary>
  -		/// <param name="component">The Component to contextualize.</param>
  -		/// <param name="context">The Context to use for component.</param>
  -		/// <exception cref="ContextException">
  -		/// If there is a problem contextualizing object.
  -		/// </exception>
  -		/// <exception cref="ArgumentException">
  -		/// If the component is <see cref="IContextualizable"/> but context is null.
  -		/// </exception>
  -		/// <remarks>
  -		/// The Context may be null in which case the specified component must not
  -		/// implement <see cref="IContextualizable"/>.
  -		/// </remarks>
  -		public static void Contextualize(object component, IContext context)
  -		{
  -			if (component is IContextualizable)
  -			{
  -				if (context == null)
  -				{
  -					throw new ArgumentException("context is null");
  -				}
  -
  -				((IContextualizable) component).Contextualize(context);
  -			}
  -		}
  -
  -		/// <summary>
  -		/// Supplies specified component with <see cref="IServiceManager"/>
  -		/// if it implements the <see cref="IServiceable"/> interface.
  +		/// Supplies specified component with <see cref="ILookupManager"/>
  +		/// if it implements the <see cref="ILookupEnabled"/> interface.
   		/// </summary>
   		/// <param name="component">The Component to service.</param>
  -		/// <param name="serviceManager">
  -		/// The <see cref="IServiceManager"/> object to use for component.
  +		/// <param name="lookupManager">
  +		/// The <see cref="ILookupManager"/> object to use for component.
   		/// </param>
   		/// <exception cref="ArgumentException">
  -		/// If the object is <see cref="IServiceable"/> but
  -		/// <see cref="IServiceManager"/> is null.
  +		/// If the object is <see cref="ILookupEnabled"/> but
  +		/// <see cref="ILookupManager"/> is null.
   		/// </exception>
  -		/// <exception cref="ServiceException">
  +		/// <exception cref="LookupException">
   		/// If there is a problem servicing component.
   		/// </exception>
   		/// <remarks>
   		/// The Service manager may be null in
   		/// which case the specified component must not
  -		/// implement <see cref="IServiceable"/>.
  +		/// implement <see cref="ILookupEnabled"/>.
   		/// </remarks>
  -		public static void Service(object component, IServiceManager serviceManager)
  +		public static void Service(object component, ILookupManager lookupManager)
   		{
  -			if (component is IServiceable)
  +			if (component is ILookupEnabled)
   			{
  -				if (serviceManager == null)
  +				if (lookupManager == null)
   				{
  -					throw new ArgumentException("ServiceManager is null");
  +					throw new ArgumentException("LookupManager is null");
   				}
   
  -				((IServiceable) component).Service(serviceManager);
  +				((ILookupEnabled) component).EnableLookups(lookupManager);
   			}
   		}
   
  @@ -190,39 +161,6 @@
   			}
   		}
   
  -
  -		/// <summary>
  -		/// Parameterizes specified object if it implements the
  -		/// <see cref="IParameterizable"/> interface.
  -		/// </summary>
  -		/// <param name="component">The Component to parameterize.</param>
  -		/// <param name="parameters">
  -		/// The Parameters object to use during parameterization.
  -		/// </param>
  -		/// <exception cref="ParameterException">
  -		/// If there is a problem parameterizing component.
  -		/// </exception>
  -		/// <excepion cref="ArgumentException">
  -		/// If the component is <see cref="IParameterizable"/> but
  -		/// parameters is null.
  -		/// </excepion>
  -		/// <remarks>
  -		/// The Parameters may be null in which case
  -		///  the specified component must not implement <see cref="IParameterizable"/>.
  -		/// </remarks>
  -		public static void Parameterize(object component, Parameters  parameters)
  -		{
  -			if (component is IParameterizable)
  -			{
  -				if (parameters == null)
  -				{
  -					throw new ArgumentException("parameters is null");
  -				}
  -
  -				((IParameterizable) component).Parameterize(parameters);
  -			}
  -		}
  -
   		/// <summary>
   		/// Initializes specified component if it implements the
   		/// <see cref="IInitializable"/> interface.
  @@ -276,7 +214,7 @@
   
   		/// <summary>
   		/// Disposes specified component if it implements the
  -		/// <see cref="Apache.AvalonFramework.Activity.IDisposable"/> interface.
  +		/// <see cref="IDisposable"/> interface.
   		/// </summary>
   		/// <param name="component">The Component to dispose.</param>
   		/// <exception cref="Exception">
  @@ -284,11 +222,10 @@
   		/// </exception>
   		public static void Dispose(object component)
   		{
  -			if (component is Apache.AvalonFramework.Activity.IDisposable)
  +			if (component is IDisposable)
   			{
  -				((Apache.AvalonFramework.Activity.IDisposable) component).Dispose();
  +				((IDisposable) component).Dispose();
   			}
   		}
  -		*/
   	}
   }
  
  
  
  1.2       +48 -0     avalon-sandbox/csframework/src/cs/ILoggable.cs
  
  Index: ILoggable.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/csframework/src/cs/ILoggable.cs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ILoggable.cs	30 Jul 2003 19:27:24 -0000	1.1
  +++ ILoggable.cs	1 Aug 2003 13:42:09 -0000	1.2
  @@ -1,3 +1,51 @@
  +// ============================================================================
  +//                   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;
   
   namespace Apache.AvalonFramework
  
  
  
  1.3       +0 -5      avalon-sandbox/csframework/src/cs/cs.csproj
  
  Index: cs.csproj
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/csframework/src/cs/cs.csproj,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- cs.csproj	30 Jul 2003 19:25:36 -0000	1.2
  +++ cs.csproj	1 Aug 2003 13:42:09 -0000	1.3
  @@ -168,11 +168,6 @@
                       BuildAction = "Compile"
                   />
                   <File
  -                    RelPath = "IContext.cs"
  -                    SubType = "Code"
  -                    BuildAction = "Compile"
  -                />
  -                <File
                       RelPath = "ILoggable.cs"
                       SubType = "Code"
                       BuildAction = "Compile"
  
  
  
  1.1                  avalon-sandbox/csframework/src/cs/IInitializable.cs
  
  Index: IInitializable.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;
  
  namespace Apache.AvalonFramework
  {
  	/// <summary>
  	/// The Initializable interface is used by components that need to allocate
  	/// resources prior to them becoming active.
  	/// </summary>
  	public interface IInitializable
  	{
  		/// <summary>
  		/// Initialize the component. Initialization includes allocating any
  		/// resources required throughout the component's lifecycle.
  		/// </summary>
  		/// <exception cref="Exception">
  		/// If the component cannot initialize properly
  		/// </exception>
  		void Initialize();
  	}
  }
  
  
  
  1.1                  avalon-sandbox/csframework/src/cs/IStartable.cs
  
  Index: IStartable.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;
  
  namespace Apache.AvalonFramework
  {
  	/// <summary>
  	/// The Startable interface is used when components need to be "running" to
  	/// be active. It provides a method through which components can be
  	/// "started" and "stopped" without requiring a thread. Note that these
  	/// methods should start the component but return imediately.
  	/// </summary>
  	public interface IStartable
  	{
  		/// <summary>
  		/// Starts the component.
  		/// </summary>
  		/// <exception cref="Exception">
  		/// If there is a problem starting the component.
  		/// </exception>
  		void Start();
  
  		/// <summary>
  		/// Stops the component.
  		/// </summary>
  		/// <exception cref="Exception">
  		/// If there is a problem stoping the component.
  		/// </exception>
  		void Stop();
  	}
  }
  
  
  
  1.1                  avalon-sandbox/csframework/src/cs/ISuspendable.cs
  
  Index: ISuspendable.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;
  
  namespace Apache.AvalonFramework
  {
  	/// <summary>
  	/// The Suspendable interface is used when a component will need to
  	/// temporarily halt execution of a component. The execution may be halted
  	/// so that you can take snapshot metrics of the component.
  	/// </summary>
  	public interface ISuspendable
  	{
  		/// <summary>
  		///   Suspends the component.
  		/// </summary>
  		void Suspend();
  
  		/// <summary>
  		///   Resumes the component.
  		/// </summary>
  		void Resume();
  	}
  }
  
  
  
  1.4       +6 -6      avalon-sandbox/csframework/src/test/ServiceExceptionTestCase.cs
  
  Index: ServiceExceptionTestCase.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/csframework/src/test/ServiceExceptionTestCase.cs,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ServiceExceptionTestCase.cs	27 Jun 2003 20:52:03 -0000	1.3
  +++ ServiceExceptionTestCase.cs	1 Aug 2003 13:42:09 -0000	1.4
  @@ -54,23 +54,23 @@
   namespace Apache.AvalonFramework.Test
   {
   	[TestFixture]
  -	public class ServiceExceptionTest
  +	public class LookupExceptionTest
   	{
   		[Test] public void Constructor()
   		{
  -			Assertion.AssertNotNull( new ServiceException() );
  -			Assertion.AssertNotNull( new ServiceException( "message" ) );
  -			Assertion.AssertNotNull( new ServiceException( "message", new Exception() ) );
  +			Assertion.AssertNotNull( new LookupException() );
  +			Assertion.AssertNotNull( new LookupException( "message" ) );
  +			Assertion.AssertNotNull( new LookupException( "message", new Exception() ) );
   		}
   
   		[Test] public void Message()
   		{
  -			ServiceException ce = new ServiceException("message");
  +			LookupException ce = new LookupException("message");
   			Assertion.AssertEquals( "message", ce.Message );
   			Assertion.AssertNull( ce.InnerException );
   
   			Exception inner = new Exception("inner");
  -			ce = new ServiceException("message", inner);
  +			ce = new LookupException("message", inner);
   			Assertion.AssertEquals("message", ce.Message);
   			Assertion.AssertEquals( inner, ce.InnerException );
   			Assertion.AssertEquals( "inner", ce.InnerException.Message );
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message