You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2005/04/07 02:07:04 UTC
svn commit: r160347 - in struts/sandbox/trunk/overdrive: Agility/Core/
Nexus/ Nexus/Core/ Nexus/Test/ PhoneBook/Core/ PhoneBook/Test/
PhoneBook/Test/Commands/
Author: husted
Date: Wed Apr 6 17:07:01 2005
New Revision: 160347
URL: http://svn.apache.org/viewcvs?view=rev&rev=160347
Log:
OVR-5
OVR-7
OVR-8
* Add Interfaces and base classes sufficient to build first failing tests.
* Tests will not pass yet. Still bootstrapping.
Added:
struts/sandbox/trunk/overdrive/Nexus/Core/
struts/sandbox/trunk/overdrive/Nexus/Core/AssemblyInfo.cs
struts/sandbox/trunk/overdrive/Nexus/Core/Core.csproj
struts/sandbox/trunk/overdrive/Nexus/Core/IController.cs
struts/sandbox/trunk/overdrive/Nexus/Core/IRequestContext.cs
struts/sandbox/trunk/overdrive/Nexus/Core/RequestContext.cs
struts/sandbox/trunk/overdrive/Nexus/Nexus.sln
struts/sandbox/trunk/overdrive/Nexus/Test/
struts/sandbox/trunk/overdrive/Nexus/Test/App.cs
struts/sandbox/trunk/overdrive/Nexus/Test/AssemblyInfo.cs
struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs
struts/sandbox/trunk/overdrive/Nexus/Test/ControllerTest.cs
struts/sandbox/trunk/overdrive/Nexus/Test/RequestContextTest.cs
struts/sandbox/trunk/overdrive/Nexus/Test/Test.csproj
Modified:
struts/sandbox/trunk/overdrive/Agility/Core/Core.csproj
struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj
struts/sandbox/trunk/overdrive/PhoneBook/Test/BaseTest.cs
struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/SelectAllTest.cs
struts/sandbox/trunk/overdrive/PhoneBook/Test/Test.csproj
Modified: struts/sandbox/trunk/overdrive/Agility/Core/Core.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Agility/Core/Core.csproj?view=diff&r1=160346&r2=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/Agility/Core/Core.csproj (original)
+++ struts/sandbox/trunk/overdrive/Agility/Core/Core.csproj Wed Apr 6 17:07:01 2005
@@ -9,7 +9,7 @@
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
- AssemblyName = "Core"
+ AssemblyName = "Agility.Core"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
@@ -18,7 +18,7 @@
OutputType = "Library"
PreBuildEvent = ""
PostBuildEvent = ""
- RootNamespace = "Core"
+ RootNamespace = "Agility.Core"
RunPostBuildEvent = "OnBuildSuccess"
StartupObject = ""
>
@@ -76,7 +76,7 @@
/>
<Reference
Name = "System.XML"
- AssemblyName = "System.XML"
+ AssemblyName = "System.Xml"
HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
/>
</References>
Added: struts/sandbox/trunk/overdrive/Nexus/Core/AssemblyInfo.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/AssemblyInfo.cs?view=auto&rev=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/AssemblyInfo.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/AssemblyInfo.cs Wed Apr 6 17:07:01 2005
@@ -0,0 +1,58 @@
+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("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[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("")]
Added: struts/sandbox/trunk/overdrive/Nexus/Core/Core.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Core.csproj?view=auto&rev=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Core.csproj (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Core.csproj Wed Apr 6 17:07:01 2005
@@ -0,0 +1,115 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{7C8CAFD4-1E45-41B4-9963-F51199B12EA7}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "Nexus.Core"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "Nexus.Core"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
+ />
+ <Reference
+ Name = "Agility.Core"
+ AssemblyName = "Agility.Core"
+ HintPath = "..\..\Agility\Core\bin\Debug\Agility.Core.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IController.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IRequestContext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RequestContext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
Added: struts/sandbox/trunk/overdrive/Nexus/Core/IController.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/IController.cs?view=auto&rev=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/IController.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/IController.cs Wed Apr 6 17:07:01 2005
@@ -0,0 +1,17 @@
+namespace Nexus.Core
+{
+ /// <summary>
+ /// The IController interacts with the caller,
+ /// controlling and managing the processing of a request.
+ /// </summary>
+ public interface IController
+ {
+ /// <summary>
+ /// Obtain and execute the IRequestContext.
+ /// </summary>
+ /// <param name="command">Our command name</param>
+ /// <returns>Context after execution</returns>
+ ///
+ IRequestContext ExecuteContext (string command);
+ }
+}
Added: struts/sandbox/trunk/overdrive/Nexus/Core/IRequestContext.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/IRequestContext.cs?view=auto&rev=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/IRequestContext.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/IRequestContext.cs Wed Apr 6 17:07:01 2005
@@ -0,0 +1,115 @@
+using System;
+using Agility.Core;
+
+namespace Nexus.Core
+{
+ /// <summary>
+ /// Exchange data between business and presentation layers per [OVR-7].
+ /// </summary>
+ /// <remarks>
+ /// <p>
+ /// An IRequestContext can predefine whatever properties we need for storing input,
+ /// output, messages, and other common attributes, including Locale (or Culture)
+ /// and user credentials.
+ /// </p>
+ /// </remarks>
+ public interface IRequestContext : IContext
+ {
+
+ /// <summary>
+ /// Return true if this context contains all of the given keys,.
+ /// </summary>
+ /// <returns>True if this context contains all of the given keys.</returns>
+ bool ContainsKeys (string[] keys);
+
+ /// <summary>
+ /// Return true if an Outcome object is present.
+ /// </summary>
+ /// <returns>True if an Outcome context is present.</returns>
+ bool HasOutcome { get; }
+
+ /// <summary>
+ /// Return a IList stored under the Command ID, if any.
+ /// </summary>
+ /// <remarks>
+ /// <p>
+ /// Some Commands returns List of values.
+ /// So that Commands can work together as part of a Chain,
+ /// list-based Commands are expected to store the
+ /// list under their own Command ID.
+ /// Outcome is a convenient method to access the
+ /// initial or "outermost" Command or Chain ID.
+ /// </p>
+ /// <p>
+ /// To allow use as subcommands in a Chain,
+ /// INexusCommand implementations should prefer the idiom
+ /// <code>Context[ID] = object</code>
+ /// to using the Outcome directly.
+ /// Since they might not be the initial Command,
+ /// but rather a subcommand, or link, in a Chain.
+ /// </p>
+ /// <p>
+ /// Outcome is more convenient to presentation layer clients,
+ /// who are looking for the top-level output,
+ /// rather than output of a particular subcommand.
+ /// </p>
+ /// <p>
+ /// As mentioned, both Outcome and the context[ID] idiom
+ /// can be used by Command that return lists of values.
+ /// Commands that return a single set of fields
+ /// can store the result directly in the main Context.
+ /// This strategy allows one Command to obtain field values
+ /// to be used by another Command
+ /// (like piping output between Unix shell commands.)
+ /// </p>
+ /// <p>
+ /// Note that "Outcome" is an "alias" to an entry in
+ /// this context.
+ /// Unlike FieldState, Outcome is not a subcontext
+ /// in its own right.
+ /// </p>
+ /// </remarks>
+ object Outcome { get; set; }
+
+ /// <summary>
+ /// A list of error messages, keyed by the field causing the error, or to a magic global key.
+ /// </summary>
+ /// <remark>
+ /// TODO: Refactor as NameValueCollection ?
+ /// </remark>
+ IContext Errors { get; set; }
+
+ /// <summary>
+ /// Add an error message under the "global" key.
+ /// </summary>
+ /// <param name="template">Message template.</param>
+ void AddError (string template);
+
+ /// <summary>
+ /// Indicate whether errors exist.
+ /// </summary>
+ /// <returns>True if there are errors. False otherwise.</returns>
+ bool HasErrors { get; }
+
+ /// <summary>
+ /// An Exception, if thrown.
+ /// </summary>
+ /// <remark>
+ /// A IViewContext is readonly,
+ /// but another interface (e.g. IHelperContext) may extend to add a setter, if needed.
+ /// </remark>
+ Exception Fault { get; set; }
+
+ /// <summary>
+ /// Indicate whether an Exception was caught.
+ /// </summary>
+ /// <returns>True if an Exception was caught.</returns>
+ bool HasFault { get; }
+
+ /// <summary>
+ /// Indicate whether context is free of faults and errors.
+ /// </summary>
+ /// <returns>True if there are no faults or errors.</returns>
+ bool IsNominal { get; }
+ }
+}
Added: struts/sandbox/trunk/overdrive/Nexus/Core/RequestContext.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/RequestContext.cs?view=auto&rev=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/RequestContext.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/RequestContext.cs Wed Apr 6 17:07:01 2005
@@ -0,0 +1,99 @@
+using System;
+using Agility.Core;
+
+namespace Nexus.Core
+{
+ /// <summary>
+ /// Summary description for RequestContext.
+ /// </summary>
+ public class RequestContext : Context, IRequestContext
+ {
+
+ public bool ContainsKeys(string[] keys)
+ {
+ // TODO: Add RequestContext.ContainsKeys implementation
+ return false;
+ }
+
+ public bool HasOutcome
+ {
+ get
+ {
+ // TODO: Add RequestContext.HasOutcome getter implementation
+ return false;
+ }
+ }
+
+ public object Outcome
+ {
+ get
+ {
+ // TODO: Add RequestContext.Outcome getter implementation
+ return null;
+ }
+ set
+ {
+ // TODO: Add RequestContext.Outcome setter implementation
+ }
+ }
+
+ public Agility.Core.IContext Errors
+ {
+ get
+ {
+ // TODO: Add RequestContext.Errors getter implementation
+ return null;
+ }
+ set
+ {
+ // TODO: Add RequestContext.Errors setter implementation
+ }
+ }
+
+ public void AddError(string template)
+ {
+ // TODO: Add RequestContext.AddError implementation
+ }
+
+ public bool HasErrors
+ {
+ get
+ {
+ // TODO: Add RequestContext.HasErrors getter implementation
+ return false;
+ }
+ }
+
+ public Exception Fault
+ {
+ get
+ {
+ // TODO: Add RequestContext.Fault getter implementation
+ return null;
+ }
+ set
+ {
+ // TODO: Add RequestContext.Fault setter implementation
+ }
+ }
+
+ public bool HasFault
+ {
+ get
+ {
+ // TODO: Add RequestContext.HasFault getter implementation
+ return false;
+ }
+ }
+
+ public bool IsNominal
+ {
+ get
+ {
+ // TODO: Add RequestContext.IsNominal getter implementation
+ return false;
+ }
+ }
+
+ }
+}
Added: struts/sandbox/trunk/overdrive/Nexus/Nexus.sln
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Nexus.sln?view=auto&rev=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Nexus.sln (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Nexus.sln Wed Apr 6 17:07:01 2005
@@ -0,0 +1,30 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "Core\Core.csproj", "{7C8CAFD4-1E45-41B4-9963-F51199B12EA7}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{C533FFAA-CB2B-40CD-B3C2-77394E4D9222}"
+ ProjectSection(ProjectDependencies) = postProject
+ {7C8CAFD4-1E45-41B4-9963-F51199B12EA7} = {7C8CAFD4-1E45-41B4-9963-F51199B12EA7}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {7C8CAFD4-1E45-41B4-9963-F51199B12EA7}.Debug.ActiveCfg = Debug|.NET
+ {7C8CAFD4-1E45-41B4-9963-F51199B12EA7}.Debug.Build.0 = Debug|.NET
+ {7C8CAFD4-1E45-41B4-9963-F51199B12EA7}.Release.ActiveCfg = Release|.NET
+ {7C8CAFD4-1E45-41B4-9963-F51199B12EA7}.Release.Build.0 = Release|.NET
+ {C533FFAA-CB2B-40CD-B3C2-77394E4D9222}.Debug.ActiveCfg = Debug|.NET
+ {C533FFAA-CB2B-40CD-B3C2-77394E4D9222}.Debug.Build.0 = Debug|.NET
+ {C533FFAA-CB2B-40CD-B3C2-77394E4D9222}.Release.ActiveCfg = Release|.NET
+ {C533FFAA-CB2B-40CD-B3C2-77394E4D9222}.Release.Build.0 = Release|.NET
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
Added: struts/sandbox/trunk/overdrive/Nexus/Test/App.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/App.cs?view=auto&rev=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/App.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/App.cs Wed Apr 6 17:07:01 2005
@@ -0,0 +1,19 @@
+namespace Nexus.Core
+{
+ /// <summary>
+ /// Tokens representing context keys.
+ /// </summary>
+ public class App
+ {
+ private App()
+ {
+ // No need to construct static helper class
+ }
+
+ /// <summary>
+ /// Token for first_name property.
+ /// </summary>
+ public const string LIST_ALL = "list_all";
+
+ }
+}
Added: struts/sandbox/trunk/overdrive/Nexus/Test/AssemblyInfo.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/AssemblyInfo.cs?view=auto&rev=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/AssemblyInfo.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/AssemblyInfo.cs Wed Apr 6 17:07:01 2005
@@ -0,0 +1,58 @@
+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("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[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("")]
Added: struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs?view=auto&rev=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs Wed Apr 6 17:07:01 2005
@@ -0,0 +1,22 @@
+using NUnit.Framework;
+
+namespace Nexus.Core
+{
+ /// <summary>
+ /// Summary description for BaseNexusTest.
+ /// </summary>
+ [TestFixture]
+ public class BaseNexusTest
+ {
+
+ protected IController controller;
+
+ [SetUp]
+ public virtual void SetUp ()
+ {
+ // TODO: Implement Objects.Facotory [OVR-8]
+ // IApplicationContext factory = Objects.Factory ();
+ // controller = new Controller (factory);
+ }
+ }
+}
Added: struts/sandbox/trunk/overdrive/Nexus/Test/ControllerTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/ControllerTest.cs?view=auto&rev=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/ControllerTest.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/ControllerTest.cs Wed Apr 6 17:07:01 2005
@@ -0,0 +1,23 @@
+using NUnit.Framework;
+
+namespace Nexus.Core
+{
+ /// <summary>
+ /// Exercise IController per [OVR-8].
+ /// </summary>
+ [TestFixture]
+ public class ControllerTest : BaseNexusTest
+ {
+
+ /// <summary>
+ /// A simple "list all" command should return nominal with an outcome.
+ /// </summary>
+ [Test]
+ public void ExecuteContext()
+ {
+ IRequestContext context = controller.ExecuteContext(App.LIST_ALL);
+ Assert.IsTrue (context.IsNominal,"Expected nominal result.");
+ Assert.IsTrue(context.HasOutcome,"Expected outcome from command.");
+ }
+ }
+}
Added: struts/sandbox/trunk/overdrive/Nexus/Test/RequestContextTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/RequestContextTest.cs?view=auto&rev=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/RequestContextTest.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/RequestContextTest.cs Wed Apr 6 17:07:01 2005
@@ -0,0 +1,89 @@
+using System;
+using System.Collections;
+using NUnit.Framework;
+
+namespace Nexus.Core
+{
+ /// <summary>
+ /// Exercise IRequestContext per [OVR-7].
+ /// </summary>
+ [TestFixture]
+ public class RequestContextTest
+ {
+
+ IRequestContext context;
+ Exception fault;
+ IList list;
+ string[] KEYS = {"KEY1","KEY2"};
+
+ /// <summary>
+ /// Initialize private fields.
+ /// </summary>
+ [SetUp]
+ public void SetUp()
+ {
+ context = new RequestContext();
+ Assert.IsTrue (context.IsNominal,"Expected nominal state for a new IRequestContext.");
+ Assert.IsFalse(context.HasOutcome,"Expected no Outcome for a new IRequestContext.");
+ Assert.IsFalse(context.ContainsKeys(KEYS),"Expected no custom keys for a new IRequestContext.");
+
+ fault = new ApplicationException("RequestContextTest");
+ list = new ArrayList();
+ list.Add("data");
+ }
+
+ /// <summary>
+ /// A IRequestContext is not nominal if an error is added.
+ /// </summary>
+ [Test]
+ public void IsNominal_Error()
+ {
+ context.AddError("Business logic error");
+ Assert.IsFalse(context.IsNominal,"Expected non-nominal state after adding error message.");
+ }
+
+ /// <summary>
+ /// A IRequestContext is not nominal is an Exception is set.
+ /// </summary>
+ [Test]
+ public void IsNominal_Fault()
+ {
+ context.Fault = fault;
+ Assert.IsFalse(context.IsNominal,"Expected non-nominal state after setting Exception.");
+ }
+
+ /// <summary>
+ /// A IRequestContext is not nominal if multiple errors are added and an Exception is set.
+ /// </summary>
+ [Test]
+ public void IsNominal_Errors_and_Fault()
+ {
+ context.AddError("Business logic error");
+ context.AddError("Business logic error 2");
+ context.Fault = fault;
+ Assert.IsFalse(context.IsNominal,"Expected non-nominal state after adding errors and Exception.");
+ }
+
+ /// <summary>
+ /// If data is set to the Outcome property, HasOutcome is true.
+ /// </summary>
+ [Test]
+ public void HasOutcome()
+ {
+ context.Outcome = list;
+ Assert.IsTrue (context.HasOutcome);
+ }
+
+ /// <summary>
+ /// If the context contains keys specified in an array, ContextKeys returns true.
+ /// </summary>
+ public void ContainsKeys()
+ {
+ foreach (string key in KEYS)
+ {
+ context[key] = key;
+ }
+ Assert.IsTrue (context.ContainsKeys (KEYS),"Expected to find keys added to context.");
+ }
+ }
+}
Added: struts/sandbox/trunk/overdrive/Nexus/Test/Test.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/Test.csproj?view=auto&rev=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/Test.csproj (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/Test.csproj Wed Apr 6 17:07:01 2005
@@ -0,0 +1,131 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{C533FFAA-CB2B-40CD-B3C2-77394E4D9222}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "Nexus.Test"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "Nexus.Core"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
+ />
+ <Reference
+ Name = "nunit.framework"
+ AssemblyName = "nunit.framework"
+ HintPath = "..\..\..\..\..\..\..\Program Files\NUnit 2.2\bin\nunit.framework.dll"
+ AssemblyFolderKey = "hklm\dn\nunit.framework"
+ />
+ <Reference
+ Name = "Nexus.Core"
+ AssemblyName = "Nexus.Core"
+ HintPath = "..\Core\bin\Debug\Nexus.Core.dll"
+ />
+ <Reference
+ Name = "Agility.Core"
+ AssemblyName = "Agility.Core"
+ HintPath = "..\..\Agility\Core\bin\Debug\Agility.Core.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "App.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BaseNexusTest.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ControllerTest.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RequestContextTest.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
Modified: struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj?view=diff&r1=160346&r2=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj Wed Apr 6 17:07:01 2005
@@ -84,6 +84,11 @@
<Files>
<Include>
<File
+ RelPath = "App.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "AssemblyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/BaseTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/BaseTest.cs?view=diff&r1=160346&r2=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Test/BaseTest.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Test/BaseTest.cs Wed Apr 6 17:07:01 2005
@@ -15,6 +15,7 @@
*/
using System;
using System.Collections;
+using Nexus.Core;
using NUnit.Framework;
namespace PhoneBook.Core
@@ -23,7 +24,7 @@
/// Base class for unit tests.
/// </summary>
[TestFixture]
- public class BaseTest
+ public class BaseTest : BaseNexusTest
{
/// <summary>
/// Dummy test to exercise infrastructure.
Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/SelectAllTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/SelectAllTest.cs?view=diff&r1=160346&r2=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/SelectAllTest.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/SelectAllTest.cs Wed Apr 6 17:07:01 2005
@@ -13,16 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+using System.Collections;
+using Nexus.Core;
using NUnit.Framework;
namespace PhoneBook.Core.Commands
{
/// <summary>
- /// Exercise SelectAll Command.
+ /// Exercise SelectAll Command per [OVR-5].
/// </summary>
[TestFixture]
public class SelectAllTest : BaseTest
{
+
/// <summary>
/// SelectAll and succeed.
/// </summary>
@@ -33,16 +36,20 @@
public void SelectAll_Pass ()
{
// TODO: Write code to pass text [OVR-5]
- /*
- IRequestContext context = Controller.ExecuteContext (App.SELECT_ALL);
- AssertNominal (context);
- AssertOutcome (context.HasOutcome);
+ IRequestContext context = controller.ExecuteContext (App.SELECT_ALL);
+ Assert.IsTrue (context.IsNominal,"Expected command to pass.");
+ Assert.IsTrue (context.HasOutcome,"Expected command to set an Outcome.");
IList list = context.Outcome as IList;
- AssertListNotEmpty(list);
+ bool notEmpty = ((list!=null) && (list.Count>0));
+ Assert.IsTrue (notEmpty,"Expected outcome to be a not-empty list");
IDictionary row = list[0] as IDictionary;
- string[] fields = {App.FIRST_NAME, App.LAST_NAME, App.USER_NAME, App.EXTENSION, App.HIRED, App.HOURS, App.EDITOR};
- AssertFields (context,fields);
- */
+ string[] KEYS = {App.FIRST_NAME, App.LAST_NAME, App.USER_NAME, App.EXTENSION, App.HIRED, App.HOURS, App.EDITOR};
+ bool valid = true;
+ foreach (string key in KEYS)
+ {
+ valid = valid && row.Contains (key);
+ }
+ Assert.IsTrue (valid,"Expected row to contain all keys.");
}
}
}
Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Test.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Test.csproj?view=diff&r1=160346&r2=160347
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Test/Test.csproj (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Test.csproj Wed Apr 6 17:07:01 2005
@@ -90,6 +90,16 @@
Project = "{3150F3E8-9A04-4FED-B16F-CEA57756E934}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
+ <Reference
+ Name = "Nexus.Core"
+ AssemblyName = "Nexus.Core"
+ HintPath = "..\..\Nexus\Core\bin\Debug\Nexus.Core.dll"
+ />
+ <Reference
+ Name = "Nexus.Test"
+ AssemblyName = "Nexus.Test"
+ HintPath = "..\..\Nexus\Test\bin\Debug\Nexus.Test.dll"
+ />
</References>
</Build>
<Files>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org