From 18a0a66ca0223236b2b7dad4cccb58db93179451 Mon Sep 17 00:00:00 2001 From: eeichinger Date: Fri, 7 Nov 2008 10:44:13 +0000 Subject: [PATCH] fixed "missing ServiceExporter in VS project" added Spring.Web LocalResourceManagerTests --- .../ServiceModel/ServiceHost.cs | 96 -------------- .../Spring.Services.2005.csproj | 1 + .../Spring.Services.2008.csproj | 3 +- .../Spring.Services.Tests.2005.csproj | 3 + .../Spring.Services.Tests.2008.csproj | 4 +- .../WithResources.aspx.resx | 123 ++++++++++++++++++ .../LocalResourceManagerTests/Web.Config | 64 +++++++++ .../WithResources.aspx | 2 + .../WithoutResources.aspx | 2 + .../Spring.Web.Tests.2005.csproj | 6 + .../Spring.Web.Tests.2008.csproj | 5 + .../Web/Support/LocalResourceManagerTests.cs | 23 +++- 12 files changed, 231 insertions(+), 101 deletions(-) delete mode 100644 src/Spring/Spring.Services/ServiceModel/ServiceHost.cs create mode 100644 test/Spring/Spring.Web.Tests/Data/Spring/Web/Support/LocalResourceManagerTests/App_LocalResources/WithResources.aspx.resx create mode 100644 test/Spring/Spring.Web.Tests/Data/Spring/Web/Support/LocalResourceManagerTests/Web.Config create mode 100644 test/Spring/Spring.Web.Tests/Data/Spring/Web/Support/LocalResourceManagerTests/WithResources.aspx create mode 100644 test/Spring/Spring.Web.Tests/Data/Spring/Web/Support/LocalResourceManagerTests/WithoutResources.aspx diff --git a/src/Spring/Spring.Services/ServiceModel/ServiceHost.cs b/src/Spring/Spring.Services/ServiceModel/ServiceHost.cs deleted file mode 100644 index da2405c2..00000000 --- a/src/Spring/Spring.Services/ServiceModel/ServiceHost.cs +++ /dev/null @@ -1,96 +0,0 @@ -#if NET_3_0 -#region License - -/* - * Copyright © 2002-2007 the original author or authors. - * - * 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. - */ - -#endregion - -#region Imports - -using System; - -using Spring.Util; -using Spring.Context; -using Spring.Context.Support; -using Spring.ServiceModel.Support; - -#endregion - -namespace Spring.ServiceModel -{ - /// - /// Provides a host for Spring-managed services. - /// - /// Bruno Baia - public class ServiceHost : System.ServiceModel.ServiceHost - { - #region Constructor(s) / Destructor - - /// - /// Creates a new instance of the class. - /// - /// The name of the service within Spring's IoC container. - /// The base addresses for the hosted service. - public ServiceHost(string serviceName, params Uri[] baseAddresses) - : this(null, serviceName, baseAddresses) - { - } - - /// - /// Creates a new instance of the class. - /// - /// The name of the context to use. - /// The name of the service within Spring's IoC container. - /// The base addresses for the hosted service. - public ServiceHost(string contextName, string serviceName, params Uri[] baseAddresses) - : base(CreateServiceType(contextName, serviceName), baseAddresses) - { - } - - private static Type CreateServiceType(string contextName, string serviceName) - { - if (StringUtils.IsNullOrEmpty(serviceName)) - { - throw new ArgumentException("The service name cannot be null or an empty string.", "serviceName"); - } - - IApplicationContext ctx; - if (StringUtils.IsNullOrEmpty(contextName)) - { - ctx = ContextRegistry.GetContext(); - if (ctx == null) - { - throw new ArgumentException("No context registered."); - } - } - else - { - ctx = ContextRegistry.GetContext(contextName); - if (ctx == null) - { - throw new ArgumentException(string.Format("Context '{0}' is not registered.", contextName)); - } - } - Type serviceType = ctx.GetType(serviceName); - - return new ServiceProxyTypeBuilder(contextName, serviceName, serviceType).BuildProxyType(); - } - - #endregion - } -} -#endif \ No newline at end of file diff --git a/src/Spring/Spring.Services/Spring.Services.2005.csproj b/src/Spring/Spring.Services/Spring.Services.2005.csproj index 2da8c262..053e44c5 100644 --- a/src/Spring/Spring.Services/Spring.Services.2005.csproj +++ b/src/Spring/Spring.Services/Spring.Services.2005.csproj @@ -127,6 +127,7 @@ + diff --git a/src/Spring/Spring.Services/Spring.Services.2008.csproj b/src/Spring/Spring.Services/Spring.Services.2008.csproj index 0b3ba4c8..6c4f349b 100644 --- a/src/Spring/Spring.Services/Spring.Services.2008.csproj +++ b/src/Spring/Spring.Services/Spring.Services.2008.csproj @@ -1,7 +1,7 @@  Local - 9.0.21022 + 9.0.30729 2.0 {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Debug @@ -130,6 +130,7 @@ Code + diff --git a/test/Spring/Spring.Services.Tests/Spring.Services.Tests.2005.csproj b/test/Spring/Spring.Services.Tests/Spring.Services.Tests.2005.csproj index ccaefaa8..bf1f9dc9 100644 --- a/test/Spring/Spring.Services.Tests/Spring.Services.Tests.2005.csproj +++ b/test/Spring/Spring.Services.Tests/Spring.Services.Tests.2005.csproj @@ -179,6 +179,9 @@ + + + diff --git a/test/Spring/Spring.Services.Tests/Spring.Services.Tests.2008.csproj b/test/Spring/Spring.Services.Tests/Spring.Services.Tests.2008.csproj index eb2dcff1..2fc31463 100644 --- a/test/Spring/Spring.Services.Tests/Spring.Services.Tests.2008.csproj +++ b/test/Spring/Spring.Services.Tests/Spring.Services.Tests.2008.csproj @@ -127,6 +127,7 @@ Code + @@ -187,9 +188,6 @@ - - - diff --git a/test/Spring/Spring.Web.Tests/Data/Spring/Web/Support/LocalResourceManagerTests/App_LocalResources/WithResources.aspx.resx b/test/Spring/Spring.Web.Tests/Data/Spring/Web/Support/LocalResourceManagerTests/App_LocalResources/WithResources.aspx.resx new file mode 100644 index 00000000..96a3872d --- /dev/null +++ b/test/Spring/Spring.Web.Tests/Data/Spring/Web/Support/LocalResourceManagerTests/App_LocalResources/WithResources.aspx.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + FromResource + + \ No newline at end of file diff --git a/test/Spring/Spring.Web.Tests/Data/Spring/Web/Support/LocalResourceManagerTests/Web.Config b/test/Spring/Spring.Web.Tests/Data/Spring/Web/Support/LocalResourceManagerTests/Web.Config new file mode 100644 index 00000000..383a9f40 --- /dev/null +++ b/test/Spring/Spring.Web.Tests/Data/Spring/Web/Support/LocalResourceManagerTests/Web.Config @@ -0,0 +1,64 @@ + + + + + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/Spring/Spring.Web.Tests/Data/Spring/Web/Support/LocalResourceManagerTests/WithResources.aspx b/test/Spring/Spring.Web.Tests/Data/Spring/Web/Support/LocalResourceManagerTests/WithResources.aspx new file mode 100644 index 00000000..8bededb7 --- /dev/null +++ b/test/Spring/Spring.Web.Tests/Data/Spring/Web/Support/LocalResourceManagerTests/WithResources.aspx @@ -0,0 +1,2 @@ +<%@ Page language="c#" EnableSessionState="ReadOnly" AutoEventWireup="false" Inherits="Spring.Web.UI.Page" %> + \ No newline at end of file diff --git a/test/Spring/Spring.Web.Tests/Data/Spring/Web/Support/LocalResourceManagerTests/WithoutResources.aspx b/test/Spring/Spring.Web.Tests/Data/Spring/Web/Support/LocalResourceManagerTests/WithoutResources.aspx new file mode 100644 index 00000000..e792a0ac --- /dev/null +++ b/test/Spring/Spring.Web.Tests/Data/Spring/Web/Support/LocalResourceManagerTests/WithoutResources.aspx @@ -0,0 +1,2 @@ +<%@ Page language="c#" EnableSessionState="ReadOnly" AutoEventWireup="false" Inherits="Spring.Web.UI.Page" %> +<%="OK"%> \ No newline at end of file diff --git a/test/Spring/Spring.Web.Tests/Spring.Web.Tests.2005.csproj b/test/Spring/Spring.Web.Tests/Spring.Web.Tests.2005.csproj index aee34892..5be50049 100644 --- a/test/Spring/Spring.Web.Tests/Spring.Web.Tests.2005.csproj +++ b/test/Spring/Spring.Web.Tests/Spring.Web.Tests.2005.csproj @@ -127,6 +127,7 @@ + @@ -135,12 +136,17 @@ + + + + Designer + diff --git a/test/Spring/Spring.Web.Tests/Spring.Web.Tests.2008.csproj b/test/Spring/Spring.Web.Tests/Spring.Web.Tests.2008.csproj index ead7ed5a..f9b3a7b1 100644 --- a/test/Spring/Spring.Web.Tests/Spring.Web.Tests.2008.csproj +++ b/test/Spring/Spring.Web.Tests/Spring.Web.Tests.2008.csproj @@ -144,6 +144,7 @@ + @@ -152,11 +153,15 @@ + + + + diff --git a/test/Spring/Spring.Web.Tests/Web/Support/LocalResourceManagerTests.cs b/test/Spring/Spring.Web.Tests/Web/Support/LocalResourceManagerTests.cs index df2e14d6..4936c40a 100644 --- a/test/Spring/Spring.Web.Tests/Web/Support/LocalResourceManagerTests.cs +++ b/test/Spring/Spring.Web.Tests/Web/Support/LocalResourceManagerTests.cs @@ -21,17 +21,38 @@ #region Imports using System; +using NUnit.Framework; +using NUnitAspEx; #endregion +#if NET_2_0 + namespace Spring.Web.Support { /// /// /// /// Erich Eichinger + [AspTestFixture("/Test", "/Spring/Web/Support/LocalResourceManagerTests")] public class LocalResourceManagerTests { + [Test] + public void ReturnsWithResources() + { + AspTestClient client = new AspTestClient(); + string result = client.GetPage("WithResources.aspx"); + Assert.AreEqual("", result); + } + [Test] + public void ReturnsWithoutResources() + { + AspTestClient client = new AspTestClient(); + string result = client.GetPage("WithoutResources.aspx"); + Assert.AreEqual("OK", result); + } } -} \ No newline at end of file +} + +#endif // NET_2_0 \ No newline at end of file