struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hus...@apache.org
Subject svn commit: r191651 - in /struts/sandbox/trunk/overdrive/PhoneBook: Core/ Core/Commands/ Test/Commands/ Test/Resources/Command/ Web/ Web/Forms/
Date Tue, 21 Jun 2005 11:47:06 GMT
Author: husted
Date: Tue Jun 21 04:47:05 2005
New Revision: 191651

URL: http://svn.apache.org/viewcvs?rev=191651&view=rev
Log:
OVR-5
* Draft test for ViewHelper (directory_view_helper) and stub implementation.

Added:
    struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/BaseFilterList.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Web/AppHelper.cs
Modified:
    struts/sandbox/trunk/overdrive/PhoneBook/Core/App.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/BaseList.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj
    struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/DirectoryViewTest.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/AppConfig.xml
    struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/Catalog.xml
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Web.config
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Core/App.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/App.cs?rev=191651&r1=191650&r2=191651&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/App.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/App.cs Tue Jun 21 04:47:05 2005
@@ -87,5 +87,10 @@
 		/// 
 		public const string DIRECTORY_VIEW = "directory_view";
 
+		/// <summary>
+		/// Token for Directory View helpere.
+		/// </summary>
+		/// 
+		public const string DIRECTORY_VIEW_HELPER = "directory_view_helper";
 	}
 }

Added: struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/BaseFilterList.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/BaseFilterList.cs?rev=191651&view=auto
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/BaseFilterList.cs (added)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/BaseFilterList.cs Tue Jun 21 04:47:05
2005
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using Nexus.Core;
+
+namespace PhoneBook.Core.Commands
+{
+	/// <summary>
+	/// Execute database statement for QueryID 
+	/// and pass through list in context under ID.
+	/// </summary>
+	/// 
+	public class BaseFilterList : AppCommand
+	{
+		public override bool RequestExecute (IRequestContext context)
+		{
+			IList rows = Mapper ().QueryForList (QueryID, null);
+			context [ID] = rows;
+			return CONTINUE;
+		}
+	}
+}
\ No newline at end of file

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/BaseList.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/BaseList.cs?rev=191651&r1=191650&r2=191651&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/BaseList.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/BaseList.cs Tue Jun 21 04:47:05
2005
@@ -30,7 +30,7 @@
 		{
 			IList rows = Mapper ().QueryForList (QueryID, null);
 			AppContextList list = new AppContextList (rows);
-			context[ID] = list;
+			context [ID] = list;
 			return CONTINUE;
 		}
 	}

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj?rev=191651&r1=191650&r2=191651&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj Tue Jun 21 04:47:05 2005
@@ -125,6 +125,11 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "Commands\BaseFilterList.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "Commands\BaseList.cs"
                     SubType = "Code"
                     BuildAction = "Compile"

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/DirectoryViewTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/DirectoryViewTest.cs?rev=191651&r1=191650&r2=191651&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/DirectoryViewTest.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/DirectoryViewTest.cs Tue Jun 21
04:47:05 2005
@@ -1,4 +1,5 @@
 using Nexus.Core;
+using Nexus.Core.Helpers;
 using NUnit.Framework;
 
 namespace PhoneBook.Core.Commands
@@ -10,23 +11,28 @@
 	[TestFixture]
 	public class DirectoryViewTest : BaseTest
 	{
-
 		/// <summary>
 		/// Confirm that context contains the expected attributes for the list filters.
 		/// </summary>
 		/// 
 		[Test]
-		public void ContainsFilters()
+		public void ContainsFilters ()
 		{
-
 			IRequestContext context = catalog.ExecuteRequest (App.DIRECTORY_VIEW);
 			string[] keys = {App.LIST_LAST_NAMES};
 			foreach (string key in keys)
 			{
-				Assert.IsTrue (context.Contains (key),key + ": Expected context to contain key.");
+				Assert.IsTrue (context.Contains (key), key + ": Expected context to contain key.");
 			}
+		}
 
-			
+		// TODO: [Test]
+		public void HelperContains ()
+		{
+			IViewHelper helper = catalog.GetHelper (App.DIRECTORY_VIEW_HELPER);
+			IRequestCommand command = helper.Command;
+			Assert.IsNotNull (command, "Expected Helper to have a Command");
+			Assert.AreEqual (App.DIRECTORY_VIEW, command.ID, "Expected Helper to have View Command.");
 		}
 	}
-}
+}
\ No newline at end of file

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/AppConfig.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/AppConfig.xml?rev=191651&r1=191650&r2=191651&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/AppConfig.xml (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/AppConfig.xml Tue Jun
21 04:47:05 2005
@@ -3,6 +3,10 @@
   "http://www.springframework.net/dtd/spring-objects.dtd">
 <objects>
 
+ <!-- Catalog -->
+ 
+	<object id="Catalog" type="Nexus.Extras.Spring.Catalog"/>
+ 
  <!-- FieldTable -->
  
 	<object id="FieldTable" type="Nexus.Core.Tables.FieldTable">

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/Catalog.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/Catalog.xml?rev=191651&r1=191650&r2=191651&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/Catalog.xml (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/Catalog.xml Tue Jun 21
04:47:05 2005
@@ -27,4 +27,7 @@
 		</property>
 	</object>
 
+  <object id="directory_view_helper" type="PhoneBook.Web.AppHelper, PhoneBook.Web">
+  </object>
+
 </objects>

Added: struts/sandbox/trunk/overdrive/PhoneBook/Web/AppHelper.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/AppHelper.cs?rev=191651&view=auto
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/AppHelper.cs (added)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/AppHelper.cs Tue Jun 21 04:47:05 2005
@@ -0,0 +1,11 @@
+using Nexus.Web.Helpers;
+
+namespace PhoneBook.Web
+{
+	/// <summary>
+	/// Extend WebViewHelper for this application.
+	/// </summary>
+	public class AppHelper : WebViewHelper
+	{
+	}
+}
\ No newline at end of file

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs?rev=191651&r1=191650&r2=191651&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs Tue Jun 21 04:47:05
2005
@@ -22,6 +22,26 @@
 
 		#endregion
 
+		#region Properties 
+
+		/// <summary>
+		/// Field for ViewHelper.
+		/// </summary>
+		/// 
+		private AppHelper _ViewHelper;
+
+		/// <summary>
+		/// Obtain dynamic data for the default view.
+		/// </summary>
+		///
+		public virtual AppHelper ViewHelper
+		{
+			get { return _ViewHelper; }
+			set { _ViewHelper = value; }
+		}
+
+		#endregion
+
 		public IList GetDataSource ()
 		{
 			BaseList command = new BaseList ();
@@ -131,9 +151,8 @@
 		{
 			if (IsPostBack)
 				Find_Filter (sender, e);
-			{
-				List_Load ();
-			}
+			else
+				ViewHelper.ExecuteBind (pnlFind.Controls);
 		}
 	}
 }

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Web.config
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Web.config?rev=191651&r1=191650&r2=191651&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Web.config (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Web.config Tue Jun 21 04:47:05 2005
@@ -16,6 +16,7 @@
     <objects xmlns="http://www.springframework.net">
     
 		<object id="Directory" type="Directory.aspx">
+			<property name="ViewHelper"><ref object="directory_view_helper"/></property>
	
 		</object>
               
    </objects>

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj?rev=191651&r1=191650&r2=191651&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj Tue Jun 21 04:47:05 2005
@@ -144,6 +144,11 @@
         <Files>
             <Include>
                 <File
+                    RelPath = "AppHelper.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "AssemblyInfo.cs"
                     SubType = "Code"
                     BuildAction = "Compile"



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message