springnet-commits Mailing List for Spring Framework .NET (Page 12)
Brought to you by:
aseovic,
markpollack
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(33) |
Aug
(163) |
Sep
(491) |
Oct
(289) |
Nov
(336) |
Dec
(84) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(227) |
Feb
(413) |
Mar
(128) |
Apr
(232) |
May
(92) |
Jun
(299) |
Jul
(386) |
Aug
(228) |
Sep
(237) |
Oct
(426) |
Nov
(325) |
Dec
(405) |
2006 |
Jan
(315) |
Feb
(311) |
Mar
(152) |
Apr
(177) |
May
(443) |
Jun
(92) |
Jul
(88) |
Aug
(80) |
Sep
(288) |
Oct
(515) |
Nov
(1049) |
Dec
(440) |
2007 |
Jan
(179) |
Feb
(406) |
Mar
(294) |
Apr
(80) |
May
(432) |
Jun
(242) |
Jul
(452) |
Aug
(710) |
Sep
(206) |
Oct
(240) |
Nov
(65) |
Dec
(227) |
2008 |
Jan
(80) |
Feb
(90) |
Mar
(98) |
Apr
(136) |
May
(101) |
Jun
(12) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Erich E. <oak...@us...> - 2008-03-21 10:49:41
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Context/Support In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23865/src/Spring/Spring.Core/Context/Support Modified Files: ContextRegistry.cs Log Message: fixed SPRNET-394 fixed SPRNET-886 Index: ContextRegistry.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Context/Support/ContextRegistry.cs,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ContextRegistry.cs 21 Mar 2007 19:24:11 -0000 1.27 --- ContextRegistry.cs 21 Mar 2008 10:49:37 -0000 1.28 *************** *** 24,28 **** using System.Collections; using System.Collections.Specialized; ! using Common.Logging; --- 24,28 ---- using System.Collections; using System.Collections.Specialized; ! using System.Configuration; using Common.Logging; *************** *** 260,268 **** } private static void InitializeContextIfNeeded() { if (rootContextName == null) { ! ConfigurationUtils.GetSection(AbstractApplicationContext.ContextSectionName); } } --- 260,283 ---- } + private static bool rootContextCurrentlyInCreation; + private static void InitializeContextIfNeeded() { if (rootContextName == null) { ! if (rootContextCurrentlyInCreation) ! { ! throw new InvalidOperationException("root context is currently in creation. You must not call ContextRegistry.GetContext() from e.g. constructors of your singleton objects"); ! } ! ! rootContextCurrentlyInCreation = true; ! try ! { ! ConfigurationUtils.GetSection(AbstractApplicationContext.ContextSectionName); ! } ! finally ! { ! rootContextCurrentlyInCreation = false; ! } } } |
From: Erich E. <oak...@us...> - 2008-03-21 10:49:41
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Aop/Framework/DynamicProxy In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23865/test/Spring/Spring.Aop.Tests/Aop/Framework/DynamicProxy Modified Files: AopUtilsTests.cs Log Message: fixed SPRNET-394 fixed SPRNET-886 Index: AopUtilsTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Aop.Tests/Aop/Framework/DynamicProxy/AopUtilsTests.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AopUtilsTests.cs 1 Aug 2007 17:51:53 -0000 1.1 --- AopUtilsTests.cs 21 Mar 2008 10:49:37 -0000 1.2 *************** *** 50,54 **** DerivedTestObject testObject = new DerivedTestObject(); IList interfaces = new ArrayList(testObject.GetType().GetInterfaces()); ! Assert.AreEqual(7, interfaces.Count, "Incorrect number of interfaces"); Assert.IsTrue(interfaces.Contains(typeof (ITestObject)), "Does not contain ITestObject"); Assert.IsTrue(interfaces.Contains(typeof (IOther)), "Does not contain IOther"); --- 50,54 ---- DerivedTestObject testObject = new DerivedTestObject(); IList interfaces = new ArrayList(testObject.GetType().GetInterfaces()); ! Assert.AreEqual(8, interfaces.Count, "Incorrect number of interfaces"); Assert.IsTrue(interfaces.Contains(typeof (ITestObject)), "Does not contain ITestObject"); Assert.IsTrue(interfaces.Contains(typeof (IOther)), "Does not contain IOther"); |
From: Erich E. <oak...@us...> - 2008-03-21 01:17:16
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/Support In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv2180/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/Support Modified Files: SessionScopeTests.cs Log Message: fixed SPRNET-785 - removed EntityInterceptor caching Index: SessionScopeTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/Support/SessionScopeTests.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SessionScopeTests.cs 23 Aug 2007 05:32:54 -0000 1.2 --- SessionScopeTests.cs 21 Mar 2008 01:17:12 -0000 1.3 *************** *** 52,56 **** expectedEntityInterceptor = (IInterceptor)repository.CreateMock(typeof(IInterceptor)); expectedSingleSession = SessionScopeSettings.SINGLESESSION_DEFAULT; ! expectedDefaultFlushMode = SessionScopeSettings.FLUSHMODE_DEFAULT; } --- 52,56 ---- expectedEntityInterceptor = (IInterceptor)repository.CreateMock(typeof(IInterceptor)); expectedSingleSession = SessionScopeSettings.SINGLESESSION_DEFAULT; ! expectedDefaultFlushMode = SessionScopeSettings.FLUSHMODE_DEFAULT; } *************** *** 109,113 **** { // ensure is open ! Assert.IsTrue( scope.IsOpen ); Assert.IsFalse(scope.IsParticipating); --- 109,113 ---- { // ensure is open ! Assert.IsTrue(scope.IsOpen); Assert.IsFalse(scope.IsParticipating); *************** *** 189,193 **** using (scope = new SessionScope(expectedSessionFactory, null, true, FlushMode.Auto, true)) { ! SessionHolder sessionHolder = (SessionHolder) TransactionSynchronizationManager.GetResource(expectedSessionFactory); Assert.IsTrue(sessionHolder.ContainsSession(expectedSession)); } --- 189,193 ---- using (scope = new SessionScope(expectedSessionFactory, null, true, FlushMode.Auto, true)) { ! SessionHolder sessionHolder = (SessionHolder)TransactionSynchronizationManager.GetResource(expectedSessionFactory); Assert.IsTrue(sessionHolder.ContainsSession(expectedSession)); } *************** *** 205,212 **** using (scope = new SessionScope(expectedSessionFactory, null, true, FlushMode.Auto, true)) { ! Assert.IsTrue(scope.IsOpen); Assert.IsFalse(scope.IsParticipating); ! using(SessionScope innerScope = new SessionScope(expectedSessionFactory, true)) { // outer scope didn't change --- 205,212 ---- using (scope = new SessionScope(expectedSessionFactory, null, true, FlushMode.Auto, true)) { ! Assert.IsTrue(scope.IsOpen); Assert.IsFalse(scope.IsParticipating); ! using (SessionScope innerScope = new SessionScope(expectedSessionFactory, true)) { // outer scope didn't change *************** *** 235,238 **** --- 235,292 ---- } + public class TestSessionScopeSettings : SessionScopeSettings + { + public TestSessionScopeSettings(ISessionFactory sessionFactory) + : base(sessionFactory) + { + } + + protected override IInterceptor ResolveEntityInterceptor() + { + return DoResolveEntityInterceptor(); + } + + public virtual IInterceptor DoResolveEntityInterceptor() + { + return base.ResolveEntityInterceptor(); + } + } + + [Test] + public void ResolvesEntityInterceptorOnEachOpen() + { + TestSessionScopeSettings sss = + (TestSessionScopeSettings) repository.PartialMock(typeof (TestSessionScopeSettings), expectedSessionFactory); + ISession expectedSession = (ISession)repository.CreateMock(typeof(ISession)); + sss.DefaultFlushMode = FlushMode.Never; + + SessionScope sc = new SessionScope( sss, false ); + + using (repository.Ordered()) + { + Expect.Call(sss.DoResolveEntityInterceptor()).Return(expectedEntityInterceptor); + Expect.Call(expectedSessionFactory.OpenSession(expectedEntityInterceptor)).Return(expectedSession); + expectedSession.FlushMode = FlushMode.Never; + Expect.Call(expectedSession.Close()).Return(null); + + Expect.Call(sss.DoResolveEntityInterceptor()).Return(expectedEntityInterceptor); + Expect.Call(expectedSessionFactory.OpenSession(expectedEntityInterceptor)).Return(expectedSession); + expectedSession.FlushMode = FlushMode.Never; + Expect.Call(expectedSession.Close()).Return(null); + } + repository.ReplayAll(); + + sc.Open(); + SessionHolder sessionHolder = (SessionHolder)TransactionSynchronizationManager.GetResource(expectedSessionFactory); + sessionHolder.ContainsSession(null); // force opening session + sc.Close(); + + sc.Open(); + sessionHolder = (SessionHolder)TransactionSynchronizationManager.GetResource(expectedSessionFactory); + sessionHolder.ContainsSession(null); // force opening session + sc.Close(); + + repository.VerifyAll(); + } } } \ No newline at end of file |
From: Erich E. <oak...@us...> - 2008-03-21 01:17:15
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate/Data/NHibernate/Support In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv2180/src/Spring/Spring.Data.NHibernate/Data/NHibernate/Support Modified Files: SessionScopeSettings.cs Log Message: fixed SPRNET-785 - removed EntityInterceptor caching Index: SessionScopeSettings.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate/Data/NHibernate/Support/SessionScopeSettings.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SessionScopeSettings.cs 22 Aug 2007 20:16:36 -0000 1.1 --- SessionScopeSettings.cs 21 Mar 2008 01:17:12 -0000 1.2 *************** *** 81,84 **** --- 81,85 ---- { // noop + this.entityInterceptorInitialized = false; } *************** *** 119,124 **** /// </summary> /// <remarks> ! /// If this property is requested for the first time, <see cref="ResolveEntityInterceptor"/> is called. ! /// This allows derived classes to override the behaviour of how to obtain the concrete <see cref="IInterceptor"/> instance. /// </remarks> public IInterceptor EntityInterceptor --- 120,126 ---- /// </summary> /// <remarks> ! /// If the entity interceptor is not set by the constructor, this property calls ! /// <see cref="ResolveEntityInterceptor"/> to obtain an instance. This allows derived classes to ! /// override the behaviour of how to obtain the concrete <see cref="IInterceptor"/> instance. /// </remarks> public IInterceptor EntityInterceptor *************** *** 128,133 **** if (!entityInterceptorInitialized) { ! entityInterceptorInitialized = true; ! entityInterceptor = ResolveEntityInterceptor(); } return entityInterceptor; --- 130,134 ---- if (!entityInterceptorInitialized) { ! return ResolveEntityInterceptor(); } return entityInterceptor; |
From: Erich E. <oak...@us...> - 2008-03-20 23:58:20
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Expressions/Processors In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4517/test/Spring/Spring.Core.Tests/Expressions/Processors Added Files: ConversionProcessorTests.cs OrderByProcessorTests.cs Log Message: SPRNET-898 --- NEW FILE: OrderByProcessorTests.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ConversionProcessorTests.cs --- (This appears to be a binary file; contents omitted.) |
From: Erich E. <oak...@us...> - 2008-03-20 23:58:20
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Expressions In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4517/test/Spring/Spring.Core.Tests/Expressions Modified Files: ExpressionEvaluatorTests.cs MethodNodeTests.cs Added Files: FunctionNodeTests.cs Log Message: SPRNET-898 Index: MethodNodeTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Expressions/MethodNodeTests.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MethodNodeTests.cs 20 Mar 2008 09:07:52 -0000 1.1 --- MethodNodeTests.cs 20 Mar 2008 23:58:16 -0000 1.2 *************** *** 22,26 **** --- 22,28 ---- using System; + using System.Collections; using NUnit.Framework; + using Spring.Expressions.Processors; #endregion *************** *** 36,83 **** public class MethodNodeTests { ! #region StopWatch ! ! private class StopWatch { ! private DateTime _startTime; ! private TimeSpan _elapsed; ! ! private class Stopper : IDisposable ! { ! private readonly StopWatch _owner; ! private readonly string _format; ! public Stopper(StopWatch owner, string format) { _owner = owner; _format = format; } ! public void Dispose() { _owner.Stop(_format); GC.SuppressFinalize(this); } ! } ! ! public IDisposable Start(string outputFormat) { ! Stopper stopper = new Stopper(this, outputFormat); ! _startTime = DateTime.Now; ! return stopper; } ! private void Stop(string outputFormat) ! { ! _elapsed = DateTime.Now.Subtract(_startTime); ! if (outputFormat != null) ! { ! Console.WriteLine(outputFormat, _elapsed); ! } ! } ! public DateTime StartTime ! { ! get { return _startTime; } ! } ! public TimeSpan Elapsed ! { ! get { return _elapsed; } ! } } - #endregion - [Test, Explicit] public void PerformanceOfMethodEvaluationOnDifferentContextTypes() --- 38,63 ---- public class MethodNodeTests { ! private class MyTestCollectionProcessor : ICollectionProcessor { ! public object Process(ICollection source, object[] args) { ! return source; } + } ! [Test] ! public void CallCustomCollectionProcessor() ! { ! Hashtable vars = new Hashtable(); ! vars["myCollProc"] = new MyTestCollectionProcessor(); ! MethodNode mn = new MethodNode(); ! mn.Text = "myCollProc"; ! IExpression exp = mn; ! int[] input = new int[] {1, 2, 3}; ! Assert.AreSame(input, exp.GetValue(input, vars)); } [Test, Explicit] public void PerformanceOfMethodEvaluationOnDifferentContextTypes() *************** *** 91,95 **** PropertyOrFieldNode pn = new PropertyOrFieldNode(); pn.Text = "InvariantCulture"; ! Expression exp = new Expression(); --- 71,75 ---- PropertyOrFieldNode pn = new PropertyOrFieldNode(); pn.Text = "InvariantCulture"; ! Expression exp = new Expression(); *************** *** 111,115 **** using (watch.Start("Duration: {0}")) { ! for (int i = 0; i < runs; i++ ) { mnExp.GetValue(0m, null); --- 91,95 ---- using (watch.Start("Duration: {0}")) { ! for (int i = 0; i < runs; i++) { mnExp.GetValue(0m, null); *************** *** 117,120 **** --- 97,144 ---- } } + + #region StopWatch + + private class StopWatch + { + private DateTime _startTime; + private TimeSpan _elapsed; + + private class Stopper : IDisposable + { + private readonly StopWatch _owner; + private readonly string _format; + public Stopper(StopWatch owner, string format) { _owner = owner; _format = format; } + public void Dispose() { _owner.Stop(_format); GC.SuppressFinalize(this); } + } + + public IDisposable Start(string outputFormat) + { + Stopper stopper = new Stopper(this, outputFormat); + _startTime = DateTime.Now; + return stopper; + } + + private void Stop(string outputFormat) + { + _elapsed = DateTime.Now.Subtract(_startTime); + if (outputFormat != null) + { + Console.WriteLine(outputFormat, _elapsed); + } + } + + public DateTime StartTime + { + get { return _startTime; } + } + + public TimeSpan Elapsed + { + get { return _elapsed; } + } + } + + #endregion } } \ No newline at end of file --- NEW FILE: FunctionNodeTests.cs --- (This appears to be a binary file; contents omitted.) Index: ExpressionEvaluatorTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Expressions/ExpressionEvaluatorTests.cs,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** ExpressionEvaluatorTests.cs 6 Mar 2008 20:20:37 -0000 1.71 --- ExpressionEvaluatorTests.cs 20 Mar 2008 23:58:16 -0000 1.72 *************** *** 1738,1741 **** --- 1738,1743 ---- int[] arr = new int[] { 24, 8, 14, 6 }; Assert.AreEqual(new int[] { 6, 8, 14, 24 }, ExpressionEvaluator.GetValue(arr, "sort()")); + Assert.AreEqual(new int[] { 6, 8, 14, 24 }, ExpressionEvaluator.GetValue(arr, "sort(true)")); + Assert.AreEqual(new int[] { 24, 14, 8, 6 }, ExpressionEvaluator.GetValue(arr, "sort(false)")); string[] arr2 = new string[] { "abc", "xyz", "stuv", "efg", "dcb" }; *************** *** 1754,1760 **** } ! [Test] ! [ExpectedException(typeof(ArgumentException))] ! public void TestSortProcessorWithUnsupportedCollectionType() { Stack stack = new Stack(new int[] { 24, 8, 14, 6 }); --- 1756,1761 ---- } ! [Test(Description="sort supports any ICollection containing elements of uniform type")] ! public void TestSortProcessorWithSimpleICollectionType() { Stack stack = new Stack(new int[] { 24, 8, 14, 6 }); *************** *** 1803,1806 **** --- 1804,1827 ---- } + [Test] + public void TestConversionProcessor() + { + object[] arr = new object[] { "0", 1, 1.1m, "1.1", 1.1f }; + decimal[] result = (decimal[]) ExpressionEvaluator.GetValue(arr, "convert(decimal)"); + Assert.AreEqual( 0.0m, result[0] ); + Assert.AreEqual(1.0m, result[1]); + Assert.AreEqual(1.1m, result[2]); + Assert.AreEqual(1.1m, result[3]); + Assert.AreEqual(1.1m, result[4]); + } + + [Test] + public void TestReverseProcessor() + { + object[] arr = new object[] { "0", 1, 2.1m, "3", 4.1f }; + object[] result = new ArrayList( (ICollection) ExpressionEvaluator.GetValue(arr, "reverse()") ).ToArray(); + Assert.AreEqual(new object[] { 4.1f, "3", 2.1m, 1, "0" }, result); + } + #endregion |
From: Erich E. <oak...@us...> - 2008-03-20 23:58:20
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Expressions/Processors In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4517/src/Spring/Spring.Core/Expressions/Processors Modified Files: OrderByProcessor.cs SortProcessor.cs Added Files: ConversionProcessor.cs ReverseProcessor.cs Log Message: SPRNET-898 Index: SortProcessor.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Expressions/Processors/SortProcessor.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SortProcessor.cs 31 Jul 2007 08:18:30 -0000 1.3 --- SortProcessor.cs 20 Mar 2008 23:58:16 -0000 1.4 *************** *** 19,26 **** #endregion using System; using System.Collections; using Spring.Collections; ! using Spring.Util; namespace Spring.Expressions.Processors --- 19,29 ---- #endregion + #region Imports + using System; using System.Collections; using Spring.Collections; ! ! #endregion namespace Spring.Expressions.Processors *************** *** 59,101 **** public object Process(ICollection source, object[] args) { ! if (source == null) { ! return null; } ! if (source.Count == 0) { ! return ObjectUtils.EmptyObjects; } ! Type elementType = DetermineElementType(source); ! Array sortedArray = Array.CreateInstance(elementType, source.Count); ! source.CopyTo(sortedArray, 0); ! Array.Sort(sortedArray); ! return sortedArray; } ! /// <summary> ! /// Tries to determine collection element type. ! /// </summary> ! /// <param name="source">Source collection.</param> ! /// <returns>A best possible element type match.</returns> ! /// <exception cref="ArgumentException"> ! /// If <paramref name="source"/> is neither <see cref="IList"/> ! /// nor <see cref="ISet"/>. ! /// </exception> ! private Type DetermineElementType(ICollection source) { ! if (source is IList) ! { ! return ((IList) source)[0].GetType(); ! } ! else if (source is ISet) ! { ! return typeof(object); ! } ! else { ! throw new ArgumentException("Sort processor can only be invoked on a list or a set."); } } } --- 62,95 ---- public object Process(ICollection source, object[] args) { ! if (source == null || source.Count == 0) { ! return source; } ! ! bool sortAscending = true; ! if (args != null && args.Length == 1 && args[0] is bool) { ! sortAscending = (bool) args[0]; } ! ArrayList list = new ArrayList(source); ! list.Sort(); ! if (!sortAscending) ! { ! list.Reverse(); ! } ! ! Type elementType = DetermineElementType(list); ! return list.ToArray(elementType); } ! private Type DetermineElementType(IList list) { ! for(int i=0;i<list.Count;i++) { ! object element = list[i]; ! if (element != null) return element.GetType(); } + return typeof (object); } } Index: OrderByProcessor.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Expressions/Processors/OrderByProcessor.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OrderByProcessor.cs 4 Dec 2006 08:58:33 -0000 1.1 --- OrderByProcessor.cs 20 Mar 2008 23:58:16 -0000 1.2 *************** *** 21,24 **** --- 21,25 ---- using System; using System.Collections; + using Spring.Util; namespace Spring.Expressions.Processors *************** *** 28,40 **** /// </summary> /// <author>Aleksandar Seovic</author> /// <version>$Id$</version> public class OrderByProcessor : ICollectionProcessor { /// <summary> /// Sorts the source collection using custom sort criteria. /// </summary> /// <remarks> ! /// Please not that this aggregator requires that collection elements ! /// are of a uniform type. /// </remarks> /// <param name="source"> --- 29,113 ---- /// </summary> /// <author>Aleksandar Seovic</author> + /// <author>Erich Eichinger</author> /// <version>$Id$</version> public class OrderByProcessor : ICollectionProcessor { + #region Comparer Helper Implementations + + private class SimpleExpressionComparer : IComparer + { + private readonly IExpression _expression; + + public SimpleExpressionComparer(IExpression expression) + { + _expression = expression; + } + + public int Compare(object x, object y) + { + x = _expression.GetValue(x); + y = _expression.GetValue(y); + + if (x==y) return 0; + + if (x != null) return ((IComparable) x).CompareTo(y); + + return ((IComparable)y).CompareTo(x)*-1; + } + } + + private class LambdaComparer : IComparer + { + private readonly Hashtable _variables; + private readonly IExpression _fn; + + public LambdaComparer(LambdaExpressionNode lambdaExpression) + { + FunctionNode functionNode = new FunctionNode(); + functionNode.Text = "compare"; + VariableNode x = new VariableNode(); + x.Text = "x"; + VariableNode y = new VariableNode(); + y.Text = "y"; + + functionNode.addChild(x); + functionNode.addChild(y); + + _fn = functionNode; + _variables = new Hashtable(); + _variables.Add( "compare", lambdaExpression ); + } + + public int Compare(object x, object y) + { + _variables["x"] = x; + _variables["y"] = y; + return (int) _fn.GetValue(null, _variables); + } + } + + private class DelegateComparer : IComparer + { + private readonly Delegate _fnCompare; + + public DelegateComparer(Delegate fnCompare) + { + _fnCompare = fnCompare; + } + + public int Compare(object x, object y) + { + return (int)_fnCompare.DynamicInvoke(new object[] { x, y }); + } + } + + #endregion + /// <summary> /// Sorts the source collection using custom sort criteria. /// </summary> /// <remarks> ! /// Please not that your compare function needs to take care about ! /// proper conversion of types to be comparable! /// </remarks> /// <param name="source"> *************** *** 49,58 **** public object Process(ICollection source, object[] args) { ! if (source == null) { ! return null; } ! throw new NotImplementedException("To be implemented..."); } } --- 122,165 ---- public object Process(ICollection source, object[] args) { ! if (source == null || source.Count == 0) { ! return source; } ! if (args == null || args.Length != 1) ! { ! throw new ArgumentException("compare expression is a required argument for orderBy"); ! } ! ! object arg = args[0]; ! IComparer comparer = null; ! if (arg is string) ! { ! IExpression expCompare = Expression.Parse((string) arg); ! comparer = new SimpleExpressionComparer(expCompare); ! } ! else if (arg is IComparer) ! { ! comparer = (IComparer) arg; ! } ! else if (arg is LambdaExpressionNode) ! { ! LambdaExpressionNode fnCompare = (LambdaExpressionNode)arg; ! if (fnCompare.ArgumentNames.Length != 2) ! { ! throw new ArgumentException("compare function must accept 2 arguments"); ! } ! comparer = new LambdaComparer(fnCompare); ! } ! else if (arg is Delegate) ! { ! comparer = new DelegateComparer((Delegate) arg); ! } ! ! AssertUtils.ArgumentNotNull(comparer, "comparer", "orderBy(comparer) argument 'comparer' does not evaluate to a supported type"); ! ! ArrayList list = new ArrayList(source); ! list.Sort(comparer); ! return list; } } --- NEW FILE: ConversionProcessor.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ReverseProcessor.cs --- (This appears to be a binary file; contents omitted.) |
From: Erich E. <oak...@us...> - 2008-03-20 23:58:20
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Util In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4517/src/Spring/Spring.Core/Util Modified Files: NumberUtils.cs Log Message: SPRNET-898 Index: NumberUtils.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Util/NumberUtils.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NumberUtils.cs 17 Feb 2007 08:28:12 -0000 1.5 --- NumberUtils.cs 20 Mar 2008 23:58:16 -0000 1.6 *************** *** 22,25 **** --- 22,27 ---- using System; + using System.ComponentModel; + using Spring.Core.TypeConversion; #endregion *************** *** 61,73 **** public static bool IsDecimal(object number) { return (number is Single || number is Double || number is Decimal); } /// <summary> ! /// Determines whether the supplied <paramref name="number"/> is decimal number. /// </summary> /// <param name="number">The object to check.</param> /// <returns> ! /// <c>true</c> if the specified object is decimal number; otherwise, <c>false</c>. /// </returns> public static bool IsNumber(object number) --- 63,76 ---- public static bool IsDecimal(object number) { + return (number is Single || number is Double || number is Decimal); } /// <summary> ! /// Determines whether the supplied <paramref name="number"/> is of numeric type. /// </summary> /// <param name="number">The object to check.</param> /// <returns> ! /// <c>true</c> if the specified object is of numeric type; otherwise, <c>false</c>. /// </returns> public static bool IsNumber(object number) *************** *** 76,79 **** --- 79,130 ---- } + /// <summary> + /// Determines whether the supplied <paramref name="number"/> can be converted to an integer. + /// </summary> + /// <param name="number">The object to check.</param> + /// <returns> + /// <see lang="true"/> if the supplied <paramref name="number"/> can be converted to an integer. + /// </returns> + public static bool CanConvertToInteger(object number) + { + TypeConverter converter = TypeDescriptor.GetConverter(number); + return (converter.CanConvertTo(typeof(Int32)) + || converter.CanConvertTo(typeof(Int16)) + || converter.CanConvertTo(typeof(Int64)) + || converter.CanConvertTo(typeof(UInt16)) + || converter.CanConvertTo(typeof(UInt64)) + || converter.CanConvertTo(typeof(Byte)) + || converter.CanConvertTo(typeof(SByte)) + ); + } + + /// <summary> + /// Determines whether the supplied <paramref name="number"/> can be converted to an integer. + /// </summary> + /// <param name="number">The object to check.</param> + /// <returns> + /// <see lang="true"/> if the supplied <paramref name="number"/> can be converted to an integer. + /// </returns> + public static bool CanConvertToDecimal(object number) + { + TypeConverter converter = TypeDescriptor.GetConverter(number); + return (converter.CanConvertTo(typeof(Single)) + || converter.CanConvertTo(typeof(Double)) + || converter.CanConvertTo(typeof(Decimal)) + ); + } + + /// <summary> + /// Determines whether the supplied <paramref name="number"/> can be converted to a number. + /// </summary> + /// <param name="number">The object to check.</param> + /// <returns> + /// <c>true</c> if the specified object is decimal number; otherwise, <c>false</c>. + /// </returns> + public static bool CanConvertToNumber(object number) + { + return (CanConvertToInteger(number) || CanConvertToDecimal(number)); + } + /// <summary> /// Is the supplied <paramref name="number"/> equal to zero (0)? |
From: Erich E. <oak...@us...> - 2008-03-20 23:58:20
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4517/src/Spring/Spring.Core Modified Files: Spring.Core.2005.csproj Log Message: SPRNET-898 Index: Spring.Core.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Spring.Core.2005.csproj,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** Spring.Core.2005.csproj 20 Mar 2008 13:19:47 -0000 1.118 --- Spring.Core.2005.csproj 20 Mar 2008 23:58:16 -0000 1.119 *************** *** 341,347 **** --- 341,349 ---- <Compile Include="Expressions\Parser\ExpressionParser.cs" /> <Compile Include="Expressions\Processors\AverageAggregator.cs" /> + <Compile Include="Expressions\Processors\ConversionProcessor.cs" /> <Compile Include="Expressions\Processors\NonNullProcessor.cs" /> <Compile Include="Expressions\Processors\OrderByProcessor.cs" /> <Compile Include="Expressions\Processors\DistinctProcessor.cs" /> + <Compile Include="Expressions\Processors\ReverseProcessor.cs" /> <Compile Include="Expressions\Processors\SortProcessor.cs" /> <Compile Include="Expressions\Processors\CountAggregator.cs" /> |
From: Erich E. <oak...@us...> - 2008-03-20 23:58:20
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4517/test/Spring/Spring.Core.Tests Modified Files: Spring.Core.Tests.2005.csproj Log Message: SPRNET-898 Index: Spring.Core.Tests.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Spring.Core.Tests.2005.csproj,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** Spring.Core.Tests.2005.csproj 20 Mar 2008 13:19:47 -0000 1.76 --- Spring.Core.Tests.2005.csproj 20 Mar 2008 23:58:16 -0000 1.77 *************** *** 273,277 **** --- 273,280 ---- <SubType>Code</SubType> </Compile> + <Compile Include="Expressions\FunctionNodeTests.cs" /> <Compile Include="Expressions\MethodNodeTests.cs" /> + <Compile Include="Expressions\Processors\ConversionProcessorTests.cs" /> + <Compile Include="Expressions\Processors\OrderByProcessorTests.cs" /> <Compile Include="Expressions\ReferenceNodeTests.cs" /> <Compile Include="Globalization\AbstractLocalizerTests.cs"> |
From: Erich E. <oak...@us...> - 2008-03-20 23:58:19
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Core/TypeConversion In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4517/src/Spring/Spring.Core/Core/TypeConversion Modified Files: TypeConversionUtils.cs Log Message: SPRNET-898 Index: TypeConversionUtils.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Core/TypeConversion/TypeConversionUtils.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TypeConversionUtils.cs 27 Aug 2007 09:38:38 -0000 1.3 --- TypeConversionUtils.cs 20 Mar 2008 23:58:16 -0000 1.4 *************** *** 118,122 **** else { ! // finally look if it's an enum if (requiredType != null && requiredType.IsEnum --- 118,122 ---- else { ! // look if it's an enum if (requiredType != null && requiredType.IsEnum *************** *** 138,145 **** } } else { throw new TypeMismatchException( ! CreatePropertyChangeEventArgs(propertyName, null, newValue), requiredType); } } --- 138,150 ---- } } + else if (newValue is IConvertible) + { + // last resort - try ChangeType + newValue = Convert.ChangeType(newValue, requiredType); + } else { throw new TypeMismatchException( ! CreatePropertyChangeEventArgs(propertyName, null, newValue), requiredType); } } |
From: Erich E. <oak...@us...> - 2008-03-20 23:58:19
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Expressions In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4517/src/Spring/Spring.Core/Expressions Modified Files: FunctionNode.cs MethodNode.cs Log Message: SPRNET-898 Index: FunctionNode.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Expressions/FunctionNode.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FunctionNode.cs 7 Sep 2007 03:01:26 -0000 1.6 --- FunctionNode.cs 20 Mar 2008 23:58:16 -0000 1.7 *************** *** 58,63 **** string name = this.getText(); LambdaExpressionNode lambda = evalContext.Variables[name] as LambdaExpressionNode; ! if (lambda == null) { throw new InvalidOperationException("Function '" + name + "' is not defined."); --- 58,64 ---- string name = this.getText(); LambdaExpressionNode lambda = evalContext.Variables[name] as LambdaExpressionNode; + Delegate function = evalContext.Variables[name] as Delegate; ! if (lambda == null && function == null) { throw new InvalidOperationException("Function '" + name + "' is not defined."); *************** *** 65,68 **** --- 66,77 ---- object[] argValues = ResolveArguments(evalContext); + + // delegate? + if (function != null) + { + return function.DynamicInvoke(argValues); + } + + // lambda! string[] argNames = lambda.ArgumentNames; Index: MethodNode.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Expressions/MethodNode.cs,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** MethodNode.cs 6 Mar 2008 20:20:36 -0000 1.20 --- MethodNode.cs 20 Mar 2008 23:58:16 -0000 1.21 *************** *** 67,70 **** --- 67,72 ---- collectionProcessorMap.Add("distinct", new DistinctProcessor()); collectionProcessorMap.Add("nonNull", new NonNullProcessor()); + collectionProcessorMap.Add("convert", new ConversionProcessor()); + collectionProcessorMap.Add("reverse", new ReverseProcessor()); } *************** *** 100,122 **** lock (this) { ! // calculate checksum, if the cached method matches the current context ! if (initialized && !isCollectionProcessor) { ! int calculatedHash = CalculateMethodHash(context.GetType(), argValues); ! initialized = (calculatedHash == methodHash); ! } ! if (!initialized) ! { ! Initialize(argValues, context); ! initialized = true; ! } ! if (isCollectionProcessor) { localCollectionProcessor = collectionProcessor; } ! else { localMethod = method; } --- 102,148 ---- lock (this) { ! if (!isCollectionProcessor) { ! if ((context == null || context is ICollection)) ! { ! string methodName = this.getText(); ! // predefined collection processor? ! collectionProcessor = (ICollectionProcessor)collectionProcessorMap[methodName]; ! isCollectionProcessor = (collectionProcessor != null); ! localCollectionProcessor = collectionProcessor; ! if (!isCollectionProcessor && evalContext.Variables != null) ! { ! localCollectionProcessor = evalContext.Variables[methodName] as ICollectionProcessor; ! } ! } ! } ! else { localCollectionProcessor = collectionProcessor; } ! ! if (localCollectionProcessor == null) { + if (context == null) + { + throw new ArgumentNullException("Context for method invocation cannot be null."); + } + + // calculate checksum, if the cached method matches the current context + if (initialized) + { + int calculatedHash = CalculateMethodHash(context.GetType(), argValues); + initialized = (calculatedHash == methodHash); + } + + if (!initialized) + { + string methodName = this.getText(); + Initialize(methodName, argValues, context); + initialized = true; + } + localMethod = method; } *************** *** 126,130 **** if (localCollectionProcessor != null) { ! return collectionProcessor.Process((ICollection)context, argValues); } else --- 152,156 ---- if (localCollectionProcessor != null) { ! return localCollectionProcessor.Process((ICollection)context, argValues); } else *************** *** 146,198 **** } ! private void Initialize(object[] argValues, object context) { ! string methodName = this.getText(); ! if ((context == null || context is ICollection) && collectionProcessorMap.Contains(methodName)) { ! collectionProcessor = (ICollectionProcessor)collectionProcessorMap[methodName]; ! isCollectionProcessor = true; } else { ! if (context == null) ! { ! throw new ArgumentNullException("Context for method invocation cannot be null."); ! } ! ! Type contextType = (context is Type ? context as Type : context.GetType()); ! ! // check the context type first ! MethodInfo mi = GetBestMethod(contextType, methodName, BINDING_FLAGS, argValues); ! ! // if not found, probe the Type's type ! if (mi == null) ! { ! mi = GetBestMethod(typeof(Type), methodName, BINDING_FLAGS, argValues); ! } ! ! if (mi == null) ! { ! throw new ArgumentException( ! string.Format("Method '{0}' with the specified number and types of arguments does not exist.", ! methodName)); ! } ! else { ! ParameterInfo[] parameters = mi.GetParameters(); ! if (parameters.Length > 0) { ! ParameterInfo lastParameter = parameters[parameters.Length - 1]; ! isParamArray = lastParameter.GetCustomAttributes(typeof(ParamArrayAttribute), false).Length > 0; ! if (isParamArray) ! { ! paramArrayType = lastParameter.ParameterType.GetElementType(); ! argumentCount = parameters.Length; ! } } - - method = new SafeMethod(mi); - methodHash = CalculateMethodHash(contextType, argValues); } } } --- 172,210 ---- } ! private void Initialize(string methodName, object[] argValues, object context) { ! Type contextType = (context is Type ? context as Type : context.GetType()); ! ! // check the context type first ! MethodInfo mi = GetBestMethod(contextType, methodName, BINDING_FLAGS, argValues); ! ! // if not found, probe the Type's type ! if (mi == null) { ! mi = GetBestMethod(typeof(Type), methodName, BINDING_FLAGS, argValues); ! } ! ! if (mi == null) ! { ! throw new ArgumentException( ! string.Format("Method '{0}' with the specified number and types of arguments does not exist.", ! methodName)); } else { ! ParameterInfo[] parameters = mi.GetParameters(); ! if (parameters.Length > 0) { ! ParameterInfo lastParameter = parameters[parameters.Length - 1]; ! isParamArray = lastParameter.GetCustomAttributes(typeof(ParamArrayAttribute), false).Length > 0; ! if (isParamArray) { ! paramArrayType = lastParameter.ParameterType.GetElementType(); ! argumentCount = parameters.Length; } } + + method = new SafeMethod(mi); + methodHash = CalculateMethodHash(contextType, argValues); } } |
From: Erich E. <oak...@us...> - 2008-03-20 20:12:16
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Expressions/Processors In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv15477/Processors Log Message: Directory /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Expressions/Processors added to the repository |
Update of /cvsroot/springnet/Spring.Net/examples/Spring/Spring.TxQuickStart/test/Spring/Spring.TxQuickStart.Tests/TxQuickStart In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23639 Added Files: aspects-config.xml system-test-dtc-config.xml system-test-local-config.xml Log Message: add missing files from tx example. --- NEW FILE: system-test-local-config.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: system-test-dtc-config.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: aspects-config.xml --- (This appears to be a binary file; contents omitted.) |
From: Erich E. <oak...@us...> - 2008-03-20 14:02:52
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/DataBinding In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4143/test/Spring/Spring.Core.Tests/DataBinding Modified Files: BaseBindingManagerTests.cs Log Message: additional test for HasTextFilteringFormatter Index: BaseBindingManagerTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/DataBinding/BaseBindingManagerTests.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BaseBindingManagerTests.cs 20 Mar 2008 13:19:47 -0000 1.5 --- BaseBindingManagerTests.cs 20 Mar 2008 14:02:47 -0000 1.6 *************** *** 24,27 **** --- 24,28 ---- using NUnit.Framework; using Spring.Core; + using Spring.Globalization.Formatters; using Spring.Objects; using Spring.Validation; *************** *** 141,148 **** source["dateofgraduation"] = null; mgr.BindSourceToTarget(source, target, null); ! target.DateOfGraduation = null; mgr.BindTargetToSource(source, target, null); } #endif --- 142,171 ---- source["dateofgraduation"] = null; + target.DateOfGraduation = DateTime.Now; mgr.BindSourceToTarget(source, target, null); + Assert.IsNull(target.DateOfGraduation); ! source["dateofgraduation"] = DateTime.Now; mgr.BindTargetToSource(source, target, null); + Assert.IsNull(source["dateofgraduation"]); + } + + [Test] + public void BindNullValuesWithFormatter() + { + Hashtable source; + Inventor target; + + target = new Inventor(); + source = new Hashtable(); + + // this is legal (dog is nullable) + BaseBindingManager mgr = new BaseBindingManager(); + mgr.AddBinding("['dateofgraduation']", "DateOfGraduation", new HasTextFilteringFormatter(null, null)); + + source["dateofgraduation"] = string.Empty; + target.DateOfGraduation = DateTime.Now; + mgr.BindSourceToTarget(source, target, null); + Assert.IsNull(target.DateOfGraduation); } #endif |
From: Erich E. <oak...@us...> - 2008-03-20 13:19:54
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv18370/test/Spring/Spring.Core.Tests Modified Files: Spring.Core.Tests.2005.csproj Log Message: HasTextFilteringFormatter solution for SPRNET-897 Index: Spring.Core.Tests.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Spring.Core.Tests.2005.csproj,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** Spring.Core.Tests.2005.csproj 20 Mar 2008 10:35:54 -0000 1.75 --- Spring.Core.Tests.2005.csproj 20 Mar 2008 13:19:47 -0000 1.76 *************** *** 283,287 **** --- 283,289 ---- <Compile Include="Globalization\Formatters\CurrencyFormatterTests.cs" /> <Compile Include="Globalization\Formatters\DateTimeFormatterTests.cs" /> + <Compile Include="Globalization\Formatters\FilteringFormatterTests.cs" /> <Compile Include="Globalization\Formatters\FloatFormatterTests.cs" /> + <Compile Include="Globalization\Formatters\HasTextFilteringFormatterTests.cs" /> <Compile Include="Globalization\Formatters\IntegerFormatterTests.cs" /> <Compile Include="Globalization\Formatters\NumberFormatterTests.cs" /> |
From: Erich E. <oak...@us...> - 2008-03-20 13:19:53
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Globalization/Formatters In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv18370/src/Spring/Spring.Core/Globalization/Formatters Added Files: FilteringFormatter.cs HasTextFilteringFormatter.cs Log Message: HasTextFilteringFormatter solution for SPRNET-897 --- NEW FILE: HasTextFilteringFormatter.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: FilteringFormatter.cs --- (This appears to be a binary file; contents omitted.) |
From: Erich E. <oak...@us...> - 2008-03-20 13:19:53
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Globalization/Formatters In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv18370/test/Spring/Spring.Core.Tests/Globalization/Formatters Added Files: FilteringFormatterTests.cs HasTextFilteringFormatterTests.cs Log Message: HasTextFilteringFormatter solution for SPRNET-897 --- NEW FILE: HasTextFilteringFormatterTests.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: FilteringFormatterTests.cs --- (This appears to be a binary file; contents omitted.) |
From: Erich E. <oak...@us...> - 2008-03-20 13:19:53
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/DataBinding In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv18370/test/Spring/Spring.Core.Tests/DataBinding Modified Files: BaseBindingManagerTests.cs Log Message: HasTextFilteringFormatter solution for SPRNET-897 Index: BaseBindingManagerTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/DataBinding/BaseBindingManagerTests.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BaseBindingManagerTests.cs 5 Feb 2008 20:40:26 -0000 1.4 --- BaseBindingManagerTests.cs 20 Mar 2008 13:19:47 -0000 1.5 *************** *** 37,45 **** public class BaseBindingManagerTests { ! private BaseBindingManager mgr = new BaseBindingManager(); [TestFixtureSetUp] public void SetUp() { mgr.AddBinding("['name']", "Name"); mgr.AddBinding("['dob']", "DOB"); --- 37,46 ---- public class BaseBindingManagerTests { ! private BaseBindingManager mgr; [TestFixtureSetUp] public void SetUp() { + mgr = new BaseBindingManager(); mgr.AddBinding("['name']", "Name"); mgr.AddBinding("['dob']", "DOB"); *************** *** 125,128 **** --- 126,151 ---- } + #if NET_2_0 + [Test] + public void BindNullValues() + { + Hashtable source; + Inventor target; + + target = new Inventor(); + source = new Hashtable(); + + // this is legal (dog is nullable) + BaseBindingManager mgr = new BaseBindingManager(); + mgr.AddBinding("['dateofgraduation']", "DateOfGraduation"); + + source["dateofgraduation"] = null; + mgr.BindSourceToTarget(source, target, null); + + target.DateOfGraduation = null; + mgr.BindTargetToSource(source, target, null); + } + #endif + [Test] public void UnhandledTypeConversionExceptionSourceToTarget() |
From: Erich E. <oak...@us...> - 2008-03-20 13:19:53
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv18370/src/Spring/Spring.Core Modified Files: Spring.Core.2005.csproj Log Message: HasTextFilteringFormatter solution for SPRNET-897 Index: Spring.Core.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Spring.Core.2005.csproj,v retrieving revision 1.117 retrieving revision 1.118 diff -C2 -d -r1.117 -r1.118 *** Spring.Core.2005.csproj 15 Mar 2008 11:19:38 -0000 1.117 --- Spring.Core.2005.csproj 20 Mar 2008 13:19:47 -0000 1.118 *************** *** 505,509 **** --- 505,511 ---- <Compile Include="Globalization\Formatters\CurrencyFormatter.cs" /> <Compile Include="Globalization\Formatters\DateTimeFormatter.cs" /> + <Compile Include="Globalization\Formatters\FilteringFormatter.cs" /> <Compile Include="Globalization\Formatters\FloatFormatter.cs" /> + <Compile Include="Globalization\Formatters\HasTextFilteringFormatter.cs" /> <Compile Include="Globalization\Formatters\IntegerFormatter.cs" /> <Compile Include="Globalization\Formatters\NullFormatter.cs" /> |
From: Erich E. <oak...@us...> - 2008-03-20 11:00:37
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Core/TypeConversion In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv31391 Modified Files: ResourceManagerConverter.cs Log Message: fixed SPRNET-861 Index: ResourceManagerConverter.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Core/TypeConversion/ResourceManagerConverter.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ResourceManagerConverter.cs 27 Aug 2007 13:57:34 -0000 1.4 --- ResourceManagerConverter.cs 20 Mar 2008 11:00:32 -0000 1.5 *************** *** 133,137 **** { Type globalResourcesType = TypeResolutionUtils.ResolveType(resourceName); ! PropertyInfo resourceManagerProperty = globalResourcesType.GetProperty("ResourceManager", BindingFlags.Public | BindingFlags.Static); return (ResourceManager) resourceManagerProperty.GetValue(globalResourcesType, null); } --- 133,138 ---- { Type globalResourcesType = TypeResolutionUtils.ResolveType(resourceName); ! // look both, NonPublic and Public properties (SPRNET-861) ! PropertyInfo resourceManagerProperty = globalResourcesType.GetProperty("ResourceManager", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static); return (ResourceManager) resourceManagerProperty.GetValue(globalResourcesType, null); } |
From: Erich E. <oak...@us...> - 2008-03-20 10:35:58
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv21752/src/Spring/Spring.Core/Objects/Factory/Support Modified Files: AbstractAutowireCapableObjectFactory.cs Log Message: fixed SPRNET-862 Index: AbstractAutowireCapableObjectFactory.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** AbstractAutowireCapableObjectFactory.cs 4 Feb 2008 22:44:03 -0000 1.84 --- AbstractAutowireCapableObjectFactory.cs 20 Mar 2008 10:35:54 -0000 1.85 *************** *** 23,26 **** --- 23,27 ---- using System; using System.Collections; + using System.Collections.Specialized; using System.Globalization; using System.Reflection; *************** *** 31,34 **** --- 32,36 ---- using Spring.Core.TypeConversion; using Spring.Core.TypeResolution; + using Spring.Expressions; using Spring.Objects; using Spring.Objects.Factory.Config; *************** *** 1798,1802 **** ExpressionHolder expHolder = (ExpressionHolder) argumentValue; object context = null; ! object variables = null; if (expHolder.Properties != null) --- 1800,1804 ---- ExpressionHolder expHolder = (ExpressionHolder) argumentValue; object context = null; ! IDictionary variables = null; if (expHolder.Properties != null) *************** *** 1808,1818 **** contextProperty.Value); PropertyValue variablesProperty = expHolder.Properties.GetPropertyValue("Variables"); ! variables = variablesProperty == null ! ? null ! : ResolveValueIfNecessary(name, definition, "Variables", ! variablesProperty.Value); } ! resolvedValue = expHolder.Expression.GetValue(context, (IDictionary) variables); } else if (argumentValue is IManagedCollection) --- 1810,1832 ---- contextProperty.Value); PropertyValue variablesProperty = expHolder.Properties.GetPropertyValue("Variables"); ! object vars = (variablesProperty == null ! ? null ! : ResolveValueIfNecessary(name, definition, "Variables", ! variablesProperty.Value)); ! if (vars is IDictionary) ! { ! variables = (IDictionary) vars; ! } ! else ! { ! if (vars != null) throw new ArgumentException("'Variables' must resolve to an IDictionary"); ! } } ! if (variables == null) variables = CollectionsUtil.CreateCaseInsensitiveHashtable(); ! // add 'this' objectfactory reference to variables ! variables.Add( Expression.ReservedVariableNames.CurrentObjectFactory, this ); ! ! resolvedValue = expHolder.Expression.GetValue(context, variables); } else if (argumentValue is IManagedCollection) |
From: Erich E. <oak...@us...> - 2008-03-20 10:35:58
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Expressions In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv21752/src/Spring/Spring.Core/Expressions Modified Files: Expression.cs ReferenceNode.cs Log Message: fixed SPRNET-862 Index: Expression.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Expressions/Expression.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Expression.cs 31 Jul 2007 00:08:42 -0000 1.18 --- Expression.cs 20 Mar 2008 10:35:54 -0000 1.19 *************** *** 47,50 **** --- 47,67 ---- public class Expression : BaseNode { + /// <summary> + /// Contains a list of reserved variable names. + /// You must not use any variable names with the reserved prefix! + /// </summary> + public class ReservedVariableNames + { + /// <summary> + /// Variable Names using this prefix are reserved for internal framework use + /// </summary> + public static readonly string RESERVEDPREFIX = "____spring_"; + + /// <summary> + /// variable name of the currently processed object factory, if any + /// </summary> + internal static readonly string CurrentObjectFactory = RESERVEDPREFIX + "CurrentObjectFactory"; + } + private class SpringASTFactory : ASTFactory { Index: ReferenceNode.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Expressions/ReferenceNode.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ReferenceNode.cs 7 Sep 2007 03:01:26 -0000 1.12 --- ReferenceNode.cs 20 Mar 2008 10:35:54 -0000 1.13 *************** *** 22,25 **** --- 22,26 ---- using System.Runtime.Serialization; using Spring.Expressions; + using Spring.Objects.Factory; namespace Spring.Context.Support *************** *** 72,75 **** --- 73,87 ---- { objectName = this.getFirstChild().getText(); + IObjectFactory currentObjectFactory = (evalContext.Variables != null) + ? (IObjectFactory)evalContext.Variables[Expression.ReservedVariableNames.CurrentObjectFactory] + : null; + + // this is a local reference within an object factory + if (currentObjectFactory != null) + { + return currentObjectFactory.GetObject(objectName); + } + + // else lookup in default context ctx = ContextRegistry.GetContext(); if (ctx == null) |
From: Erich E. <oak...@us...> - 2008-03-20 10:35:58
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv21752/test/Spring/Spring.Core.Tests Modified Files: Spring.Core.Tests.2005.csproj Added Files: StringResource.cs Log Message: fixed SPRNET-862 --- NEW FILE: StringResource.cs --- (This appears to be a binary file; contents omitted.) Index: Spring.Core.Tests.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Spring.Core.Tests.2005.csproj,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** Spring.Core.Tests.2005.csproj 20 Mar 2008 09:07:52 -0000 1.74 --- Spring.Core.Tests.2005.csproj 20 Mar 2008 10:35:54 -0000 1.75 *************** *** 274,277 **** --- 274,278 ---- </Compile> <Compile Include="Expressions\MethodNodeTests.cs" /> + <Compile Include="Expressions\ReferenceNodeTests.cs" /> <Compile Include="Globalization\AbstractLocalizerTests.cs"> <SubType>Code</SubType> *************** *** 628,631 **** --- 629,633 ---- <SubType>Code</SubType> </Compile> + <Compile Include="StringResource.cs" /> <Compile Include="Threading\AsyncTestMethod.cs" /> <Compile Include="Threading\AsyncTestTask.cs" /> |
From: Erich E. <oak...@us...> - 2008-03-20 10:35:58
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Expressions In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv21752/test/Spring/Spring.Core.Tests/Expressions Added Files: ReferenceNodeTests.cs Log Message: fixed SPRNET-862 --- NEW FILE: ReferenceNodeTests.cs --- (This appears to be a binary file; contents omitted.) |