SPRNET-1460: Drop Framework 1.x Support

This commit is contained in:
Marko Lahma
2011-08-15 19:49:17 +03:00
parent ffdeea9d8d
commit de5b921407
80 changed files with 213 additions and 31027 deletions

View File

@@ -32,10 +32,6 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyVersion("1.3.1.30001")]
#elif NET_2_0
[assembly: AssemblyVersion("1.3.1.20001")]
#elif NET_1_1
[assembly: AssemblyVersion("1.3.1.11001")]
#elif NET_1_0
[assembly: AssemblyVersion("1.3.1.10001")]
#endif
//

View File

@@ -26,7 +26,6 @@ using NUnit.Framework;
using Spring.Objects;
using Spring.Aop.Interceptor;
using Spring.Proxy;
using System.Reflection;
using Spring.Expressions;
@@ -229,7 +228,6 @@ namespace Spring.Aop.Framework.DynamicProxy
Assert.AreEqual(3, ni.Count);
}
#if !NET_1_0
[Test]
public void DoesNotInterceptInternalMethod()
{
@@ -247,7 +245,6 @@ namespace Spring.Aop.Framework.DynamicProxy
proxiedClass.InternalToDo();
Assert.AreEqual(0, ni.Count);
}
#endif
[Test]
public void InterceptVirtualMethodThatBelongsToAnInterface()
@@ -426,7 +423,6 @@ namespace Spring.Aop.Framework.DynamicProxy
}
#if !NET_1_0
// "internal virtual" is not supported on net 1.0 CLR
// see http://support.microsoft.com/?scid=kb%3Ben-us%3B317129&x=11&y=12
internal virtual void InternalToDo()
@@ -434,8 +430,6 @@ namespace Spring.Aop.Framework.DynamicProxy
}
#endif
internal protected virtual void InternalProtectedToDo()
{

View File

@@ -178,7 +178,7 @@ namespace Spring.Aop.Support
Assert.IsTrue(matches, "Implementing method from subclass was not decorated with the target attribute " +
"but the method from an indirectly implemented interface was, so this must match.");
}
#if !NET_1_0 && !NET_1_1
/// <summary>
/// Confirms that methods, explicitly implemented in the derived classes will match
/// </summary>
@@ -198,7 +198,7 @@ namespace Spring.Aop.Support
}
}
#endif
#region Helper classes definitions
[AttributeUsage(AttributeTargets.Method)]

View File

@@ -1,9 +1,3 @@
using System;
using System.Collections;
using System.Globalization;
using System.Text;
using Common.Logging;
using Common.Logging.Simple;
@@ -12,17 +6,12 @@ namespace Spring.Aspects.Exceptions
public class CaptureOutputLogger : TraceLogger
{
public static readonly string NAME = "capturingLogger";
#if NET_1_0 || NET_1_1
public CaptureOutputLogger()
: base(NAME, LogLevel.All, false, false, null)
{}
#else
public CaptureOutputLogger()
: base(NAME, LogLevel.All, false, false, null)
// TODO: use this line when upgrading to Common.Logging 2.0:
// : base(false, NAME, LogLevel.All, true, false, false, null)
{ }
#endif
// private LogLevel _currentLogLevel = LogLevel.All;
//

View File

@@ -30,7 +30,6 @@ using NUnit.Framework;
using Spring.Objects;
using Spring.Proxy;
using Spring.Objects.Factory.Support;
using Spring.Reflection.Dynamic;
using Spring.Util;
#endregion
@@ -53,7 +52,6 @@ namespace Spring.Context.Support
private static void ResetConfigurationSystem()
{
#if NET_2_0
if (SystemUtils.MonoRuntime)
{
return;
@@ -61,28 +59,6 @@ namespace Spring.Context.Support
FieldInfo initStateRef = typeof(ConfigurationManager).GetField("s_initState", BindingFlags.NonPublic | BindingFlags.Static);
object notStarted = Activator.CreateInstance(initStateRef.FieldType);
initStateRef.SetValue(null, notStarted);
#endif
#if NET_1_1
FieldInfo initStateRef = typeof(ConfigurationSettings).GetField("_initState",BindingFlags.NonPublic|BindingFlags.Static);
if (initStateRef!=null)
{
object notStarted = Activator.CreateInstance(initStateRef.FieldType);
initStateRef.SetValue(null,notStarted);
}
else
{
FieldInfo configurationInitializedRef = typeof(ConfigurationSettings).GetField("_configurationInitialized",BindingFlags.NonPublic|BindingFlags.Static);
configurationInitializedRef.SetValue(null, false);
}
#endif
#if NET_1_0
FieldInfo initStateRef = typeof(ConfigurationSettings).GetField("_configurationInitialized",BindingFlags.NonPublic|BindingFlags.Static);
FieldInfo configSystemRef = typeof(ConfigurationSettings).GetField("_configSystem",BindingFlags.NonPublic|BindingFlags.Static);
initStateRef.SetValue(null,false);
configSystemRef.SetValue(null,null);
#endif
}
/// <summary>
@@ -100,7 +76,7 @@ namespace Spring.Context.Support
{
return ContextRegistry.GetContext(); // this must fail!
}
#if !NET_1_1
[Test]
public void ThrowsInvalidOperationExceptionOnRecursiveCallsToGetContext()
{
@@ -119,7 +95,6 @@ namespace Spring.Context.Support
}
}
}
#endif
[Test]
public void RegisterRootContext()

View File

@@ -334,7 +334,6 @@ namespace Spring.Context.Support
return sbText.ToString();
}
#if ! NET_1_0
/// <summary>
/// Test applying a family of resources to an object.
/// </summary>
@@ -351,7 +350,6 @@ namespace Spring.Context.Support
Assert.AreEqual("Mark", to.Name);
Assert.AreEqual(35, to.Age);
}
#endif
/// <summary>
/// Test when the code being resolves itself implements IMessageResolvable.

View File

@@ -80,27 +80,14 @@ namespace Spring.Context.Support
msgSource.ToString());
}
[Test]
public void ApplyResources()
{
TestObject value = new TestObject();
StaticMessageSource msgSource = new StaticMessageSource();
#if ! NET_1_0
msgSource.ApplyResources(value, "testObject", CultureInfo.InvariantCulture);
Assert.AreEqual("Mark", value.Name, "Name property value not applied.");
Assert.AreEqual(35, value.Age, "Age property value not applied.");
#else
try
{
msgSource.ApplyResources(value, "testObject", CultureInfo.InvariantCulture);
Assert.Fail("Should not be supported in 1.0");
} catch (NotSupportedException e)
{
Assert.AreEqual("Operation not supported in .NET 1.0 Release.",
e.Message);
}
#endif
}
[Test]
@@ -108,21 +95,9 @@ namespace Spring.Context.Support
{
TestObject value = new TestObject();
StaticMessageSource msgSource = new StaticMessageSource();
#if ! NET_1_0
msgSource.ApplyResources(null, "testObject", CultureInfo.InvariantCulture);
Assert.AreEqual(null, value.Name);
Assert.AreEqual(0, value.Age);
#else
try
{
msgSource.ApplyResources(null, "testObject", CultureInfo.InvariantCulture);
Assert.Fail("Should not be supported in 1.0");
} catch (NotSupportedException e)
{
Assert.AreEqual("Operation not supported in .NET 1.0 Release.",
e.Message);
}
#endif
}
[Test]
@@ -130,7 +105,7 @@ namespace Spring.Context.Support
{
TestObject value = new TestObject();
StaticMessageSource msgSource = new StaticMessageSource();
#if ! NET_1_0
try
{
msgSource.ApplyResources(value, null, CultureInfo.InvariantCulture);
@@ -141,18 +116,6 @@ namespace Spring.Context.Support
}
Assert.AreEqual(null, value.Name);
Assert.AreEqual(0, value.Age);
#else
try
{
msgSource.ApplyResources(value, null, CultureInfo.InvariantCulture);
Assert.Fail("Should not be supported in 1.0");
}
catch (NotSupportedException e)
{
Assert.AreEqual("Operation not supported in .NET 1.0 Release.",
e.Message);
}
#endif
}
[Test]

View File

@@ -31,8 +31,6 @@ using Spring.Context.Support;
#endregion
#if ! NET_1_0
namespace Spring.Globalization.Localizers
{
/// <summary>
@@ -64,5 +62,3 @@ namespace Spring.Globalization.Localizers
}
}
}
#endif

View File

@@ -123,7 +123,7 @@ namespace Spring.Objects.Factory.Config
Assert.AreEqual("value2", dvs.ResolveVariable("key2"));
}
#if (!NET_2_0 && !NET_1_0 && !NET_1_1)
#if !NET_2_0
[Test]
public void Initialize_WithInlineDictionarySyntax()
{

View File

@@ -18,14 +18,9 @@
#endregion
#if !NET_1_1
#region Imports
using System;
using System.Collections;
using System.Collections.Specialized;
using NUnit.Framework;
using Spring.Collections;
using Spring.Objects.Factory.Support;
#endregion
@@ -65,4 +60,3 @@ namespace Spring.Objects.Factory.Xml
}
}
#endif

View File

@@ -20,10 +20,7 @@
#region Imports
using System;
using System.IO;
using System.Xml;
using System.Xml.Schema;
using NUnit.Framework;
using Spring.Core.IO;
using Spring.Objects.Factory.Config;
@@ -69,7 +66,6 @@ namespace Spring.Objects.Factory.Xml
NamespaceParserRegistry.Reset();
}
#if !NET_1_0
/// <summary>
/// This test doesn't work on .NET 1.0 because there are no XmlResolvers for schema loading...
/// </summary>
@@ -85,6 +81,5 @@ namespace Spring.Objects.Factory.Xml
ConfigXmlDocument newDoc = new ConfigXmlDocument();
newDoc.Load(vr);
}
#endif
}
}

View File

@@ -1126,14 +1126,9 @@ namespace Spring.Objects.Factory.Xml
ITestObject kerry = (ITestObject) xof.GetObject("spouse");
ITestObject kerry2 = (ITestObject)xof.GetObject("spouse2");
ArrayCtorDependencyObject rod7 = (ArrayCtorDependencyObject) xof.GetObject("rod7");
#if NET_1_0 || NET_1_1
// Lack of OrderedDictionary means we can't predict the ordering of the autowiring.
Assert.IsNotNull(rod7.Spouse1);
Assert.IsNotNull(rod7.Spouse2);
#else
Assert.AreEqual(kerry, rod7.Spouse1);
Assert.AreEqual(kerry2, rod7.Spouse2);
#endif
}
[Test]

View File

@@ -22,9 +22,7 @@
using System;
using System.Collections;
#if !NET_1_1
using System.Collections.Generic;
#endif
using System.Collections.Specialized;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
@@ -269,13 +267,11 @@ namespace Spring.Objects
set { this.someList = value;}
}
#if !NET_1_1
public virtual List<string> SomeGenericStringList
{
get { return someGenericStringList; }
set { this.someGenericStringList = value; }
}
#endif
public virtual NameValueCollection SomeNameValueCollection
{
@@ -408,9 +404,7 @@ namespace Spring.Objects
private IDictionary sharedState;
private NameValueCollection someNameValueCollection;
#if !NET_1_1
private List<string> someGenericStringList;
#endif
#endregion

View File

@@ -1213,12 +1213,7 @@ namespace Spring.Util
{
IList attrs = ReflectionUtils.GetCustomAttributes(typeof(ClassWithAttributes));
#if NET_1_1
// "GetCustomAttributes() does not return SecurityAttribute in .NET 1.x"
Assert.AreEqual(1, attrs.Count);
#else
Assert.AreEqual(2, attrs.Count);
#endif
}
[Test]
@@ -1226,12 +1221,7 @@ namespace Spring.Util
{
IList attrs = ReflectionUtils.GetCustomAttributes(typeof(ClassWithAttributes).GetMethod("MethodWithAttributes"));
#if NET_1_1
// "GetCustomAttributes() does not return SecurityAttribute in .NET 1.x"
Assert.AreEqual(1, attrs.Count);
#else
Assert.AreEqual(2, attrs.Count);
#endif
}
#endregion

View File

@@ -18,8 +18,6 @@
#endregion
#if (!NET_1_0)
#region
using System;
@@ -263,5 +261,3 @@ namespace Spring.Data
}
}
}
#endif // (!NET_1_0)

View File

@@ -18,11 +18,9 @@
#endregion
#if !NET_1_0
#region Imports
using System;
using System.Collections;
using System.Runtime.Serialization;
using NUnit.Framework;
using Spring.Aop.Framework;
@@ -229,4 +227,3 @@ namespace Spring.Dao.Attributes
}
}
#endif

View File

@@ -17,10 +17,9 @@
*/
#endregion
#if !NET_1_0
#region Imports
using NUnit.Framework;
using Spring.Aop.Framework;
using Spring.Dao.Support;
using Spring.Objects.Factory.Support;
@@ -54,4 +53,3 @@ namespace Spring.Dao.Attributes
}
}
}
#endif

View File

@@ -17,7 +17,7 @@
*/
#endregion
#if !NET_1_0
#region Imports
using NUnit.Framework;
@@ -99,4 +99,3 @@ namespace Spring.Dao.Attributes
}
}
}
#endif

View File

@@ -225,43 +225,6 @@ namespace Spring.Data.Common
}
#if NET_1_1
[Test]
public void DefaultInstanceWithOleDb11()
{
IDbProvider provider = DbProviderFactory.GetDbProvider("OleDb-1.1");
Assert.AreEqual("OleDb, provider V1.0.5000.0 in framework .NET V1.1", provider.DbMetadata.ProductName);
Assert.IsNotNull(provider.CreateCommand());
Assert.IsNotNull(provider.CreateCommandBuilder());
Assert.IsNotNull(provider.CreateConnection());
Assert.IsNotNull(provider.CreateDataAdapter());
Assert.IsNotNull(provider.CreateParameter());
Assert.AreEqual("?", provider.CreateParameterName("Foo"));
}
[Test]
public void DefaultInstanceWithSqlServer2000()
{
IDbProvider provider = DbProviderFactory.GetDbProvider("SqlServer-1.1");
AssertIsSqlServer2000(provider);
Assert.IsNull(provider.ConnectionString);
Assert.IsNotNull(provider.CreateCommand());
Assert.IsNotNull(provider.CreateCommandBuilder());
Assert.IsNotNull(provider.CreateConnection());
Assert.IsNotNull(provider.CreateDataAdapter());
Assert.IsNotNull(provider.CreateParameter());
Assert.AreEqual("@Foo", provider.CreateParameterName("Foo"));
}
private void AssertIsSqlServer2000(IDbProvider provider)
{
Assert.AreEqual("Microsoft SQL Server, provider V1.0.5000.0 in framework .NET V1.1",
provider.DbMetadata.ProductName);
AssertCommonSqlServerErrorCodes(provider);
}
#endif
private void AssertIsSqlServer2005(IDbProvider provider)
{
Assert.AreEqual("Microsoft SQL Server, provider V2.0.0.0 in framework .NET V2.0",
@@ -286,7 +249,5 @@ namespace Spring.Data.Common
// This had better NOT be
Assert.IsFalse(Array.IndexOf(codes.BadSqlGrammarCodes, "1xx56") >= 0);
}
}
}
}

View File

@@ -212,11 +212,9 @@ namespace Spring.Data.Common
IDbDataAdapter mockDataAdapter = (IDbDataAdapter) mocks.CreateMock(typeof (IDbDataAdapter));
Expect.Call(dbProvider.CreateDataAdapter()).Return(mockDataAdapter).Repeat.Once();
#if !NET_1_1
DbCommandBuilder mockDbCommandBuilder = (DbCommandBuilder) mocks.CreateMock(typeof (DbCommandBuilder));
Expect.Call(dbProvider.CreateCommandBuilder()).Return(mockDbCommandBuilder).Repeat.Once();
#endif
Expect.Call(dbProvider.CreateParameterName("p1")).Return("@p1").Repeat.Once();
Expect.Call(dbProvider.CreateParameterNameForCollection("c1")).Return("cc1");
@@ -226,9 +224,7 @@ namespace Spring.Data.Common
Exception e = new Exception("foo");
Expect.Call(dbProvider.ExtractError(e)).Return("badsql").Repeat.Once();
#if !NET_1_1
DbException dbException = (DbException) mocks.CreateMock(typeof (DbException));
#endif
MultiDelegatingDbProvider multiDbProvider = new MultiDelegatingDbProvider();
@@ -245,19 +241,12 @@ namespace Spring.Data.Common
Assert.IsNotNull(multiDbProvider.CreateCommand());
Assert.IsNotNull(multiDbProvider.CreateParameter());
Assert.IsNotNull(multiDbProvider.CreateDataAdapter());
#if !NET_1_1
Assert.IsNotNull(multiDbProvider.CreateCommandBuilder() as DbCommandBuilder);
#endif
Assert.AreEqual("@p1", multiDbProvider.CreateParameterName("p1"));
Assert.AreEqual("cc1", multiDbProvider.CreateParameterNameForCollection("c1"));
Assert.IsNotNull(multiDbProvider.DbMetadata);
Assert.AreEqual("badsql", multiDbProvider.ExtractError(e));
#if !NET_1_1
Assert.IsTrue(multiDbProvider.IsDataAccessException(dbException));
#endif
Assert.IsFalse(multiDbProvider.IsDataAccessException(e));
mocks.VerifyAll();
}

View File

@@ -18,9 +18,6 @@
#endregion
#if (!NET_1_0)
#region Imports
using System;
@@ -276,4 +273,3 @@ namespace Spring.Data.Core
}
#endif

View File

@@ -63,18 +63,12 @@ namespace Spring.Data
{
LOG.Debug("TransactionActive = " + TransactionSynchronizationManager.ActualTransactionActive);
}
#if !NET_1_0 && !NET_1_1
[Transaction(TransactionPropagation.Required, IsolationLevel.Unspecified, Timeout = 50,
RollbackFor = new Type[]{typeof(ArgumentNullException)},
ReadOnly = false,
EnterpriseServicesInteropOption = System.Transactions.EnterpriseServicesInteropOption.Automatic,
NoRollbackFor = new Type[] { typeof(ArithmeticException), typeof(NotSupportedException) })]
#else
[Transaction(TransactionPropagation.Required, IsolationLevel.Unspecified, Timeout = 50,
RollbackFor = new Type[]{typeof(ArgumentNullException)},
ReadOnly = false,
NoRollbackFor = new Type[] { typeof(ArithmeticException), typeof(NotSupportedException) })]
#endif
public void DeleteTwoTestObjects(string name1, string name2)
{
}

View File

@@ -1,4 +1,3 @@
#if !NET_1_0
#region Licence
/*
@@ -107,4 +106,3 @@ namespace Spring.Support
}
}
}
#endif

View File

@@ -18,7 +18,7 @@
#endregion
#if (NET_2_0 && !MONO)
#if !MONO
#region Imports
@@ -215,4 +215,4 @@ namespace Spring.EnterpriseServices
}
}
#endif // (!NET_1_0)
#endif // !MONO

View File

@@ -25,7 +25,6 @@ using System.Web;
using NUnit.Framework;
using Rhino.Mocks;
using Spring.Context;
using Spring.Objects.Factory.Config;
using Spring.Objects.Factory.Support;
#endregion
@@ -214,54 +213,15 @@ namespace Spring.Web.Support
private static IDisposable Record(MockRepository mocks)
{
#if !NET_1_1
return mocks.Record();
#else
return new RecordModeChanger(mocks);
#endif
}
private static IDisposable Playback(MockRepository mocks)
{
#if !NET_1_1
return mocks.Playback();
#else
return new PlaybackModeChanger(mocks);
#endif
}
#if NET_1_1
private class RecordModeChanger : IDisposable
{
private MockRepository _mocks;
public RecordModeChanger(MockRepository mocks)
{
_mocks = mocks;
}
public void Dispose()
{
_mocks.ReplayAll();
}
}
private class PlaybackModeChanger : IDisposable
{
private MockRepository _mocks;
public PlaybackModeChanger(MockRepository mocks)
{
_mocks = mocks;
}
public void Dispose()
{
_mocks.VerifyAll();
}
}
#endif
#endregion Rhino.Mocks Compatibility Adapter
#endregion Rhino.Mocks Compatibility Adapter
}
}

View File

@@ -23,7 +23,6 @@
using System;
using NUnit.Framework;
using Rhino.Mocks;
using Spring.Util;
#endregion
@@ -136,54 +135,14 @@ namespace Spring.Web.Support
private static IDisposable Record( MockRepository mocks )
{
#if !NET_1_1
return mocks.Record();
#else
return new RecordModeChanger(mocks);
#endif
}
private static IDisposable Playback( MockRepository mocks )
{
#if !NET_1_1
return mocks.Playback();
#else
return new PlaybackModeChanger(mocks);
#endif
}
#if NET_1_1
private class RecordModeChanger : IDisposable
{
private MockRepository _mocks;
public RecordModeChanger(MockRepository mocks)
{
_mocks = mocks;
}
public void Dispose()
{
_mocks.ReplayAll();
}
}
private class PlaybackModeChanger : IDisposable
{
private MockRepository _mocks;
public PlaybackModeChanger(MockRepository mocks)
{
_mocks = mocks;
}
public void Dispose()
{
_mocks.VerifyAll();
}
}
#endif
#endregion Rhino.Mocks Compatibility Adapter
}
}