fixed "missing ServiceExporter in VS project"

added Spring.Web LocalResourceManagerTests
This commit is contained in:
eeichinger
2008-11-07 10:44:13 +00:00
parent 0e45ffc151
commit 18a0a66ca0
12 changed files with 231 additions and 101 deletions

View File

@@ -1,96 +0,0 @@
#if NET_3_0
#region License
/*
* Copyright <20> 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
{
/// <summary>
/// Provides a host for Spring-managed services.
/// </summary>
/// <author>Bruno Baia</author>
public class ServiceHost : System.ServiceModel.ServiceHost
{
#region Constructor(s) / Destructor
/// <summary>
/// Creates a new instance of the <see cref="Spring.ServiceModel.ServiceHost"/> class.
/// </summary>
/// <param name="serviceName">The name of the service within Spring's IoC container.</param>
/// <param name="baseAddresses">The base addresses for the hosted service.</param>
public ServiceHost(string serviceName, params Uri[] baseAddresses)
: this(null, serviceName, baseAddresses)
{
}
/// <summary>
/// Creates a new instance of the <see cref="Spring.ServiceModel.ServiceHost"/> class.
/// </summary>
/// <param name="contextName">The name of the context to use.</param>
/// <param name="serviceName">The name of the service within Spring's IoC container.</param>
/// <param name="baseAddresses">The base addresses for the hosted service.</param>
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

View File

@@ -127,6 +127,7 @@
</Compile>
<Compile Include="ServiceModel\Activation\ServiceHostFactory.cs" />
<Compile Include="ServiceModel\Activation\ServiceHostFactoryObject.cs" />
<Compile Include="ServiceModel\ServiceExporter.cs" />
<Compile Include="ServiceModel\SpringServiceHost.cs" />
<Compile Include="ServiceModel\Support\ServiceProxyTypeBuilder.cs" />
<Compile Include="ServiceModel\Support\SpringInstanceProvider.cs" />

View File

@@ -1,7 +1,7 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>9.0.21022</ProductVersion>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -130,6 +130,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="ServiceModel\Activation\ServiceHostFactoryObject.cs" />
<Compile Include="ServiceModel\ServiceExporter.cs" />
<Compile Include="ServiceModel\Support\SpringInstanceProvider.cs" />
<Compile Include="ServiceModel\Support\SpringServiceBehavior.cs" />
<Compile Include="ServiceModel\SpringServiceHost.cs" />

View File

@@ -179,6 +179,9 @@
<ItemGroup>
<EmbeddedResource Include="Data\Spring\Remoting\saoSingleton-aop.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Data\Spring\Remoting\saoSingleton-autowired.xml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>

View File

@@ -127,6 +127,7 @@
<Compile Include="Remoting\SimpleCounter.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ServiceModel\ServiceExporterTests.cs" />
<Compile Include="Web\Services\WebServiceProxyFactoryTests.cs" />
<EmbeddedResource Include="Data\Spring\Web\Services\rpc-literal.wsdl" />
<EmbeddedResource Include="Data\Spring\Web\Services\document-literal.wsdl" />
@@ -187,9 +188,6 @@
<ItemGroup>
<EmbeddedResource Include="Data\Spring\Remoting\saoSingleton-autowired.xml" />
</ItemGroup>
<ItemGroup>
<Folder Include="ServiceModel\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="$this.Result.Text" xml:space="preserve">
<value>FromResource</value>
</data>
</root>

View File

@@ -0,0 +1,64 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/>
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
</sectionGroup>
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
</configSections>
<!-- to see logging output in the attached debugger -->
<common>
<logging>
<factoryAdapter type="Common.Logging.Simple.TraceLoggerFactoryAdapter, Common.Logging">
<arg key="Level" value="ALL" />
</factoryAdapter>
</logging>
</common>
<system.web>
<compilation debug="true" />
<!--
The following needs to be configured in order to enable Spring.NET Web Framework features
-->
<httpModules>
<add name="SpringModule" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
<add name="NUnitAspExModule" type="NUnitAspEx.AspTestExecutionModule, NUnitAspEx" />
</httpModules>
<httpHandlers>
<add verb="*" path="*.oaspx" type="System.Web.UI.PageHandlerFactory"/>
<add verb="*" path="*.aspx" type="Spring.Web.Support.PageHandlerFactory, Spring.Web"/>
<add verb="*" path="*.testmethod" type="NUnitAspEx.AspTestMethodHandler, NUnitAspEx" validate="false" />
</httpHandlers>
</system.web>
<!-- demonstrates how to configure IHttpModule instances -->
<spring>
<context>
<resource uri="config://spring/objects"/>
</context>
<objects xmlns="http://www.springframework.net">
<object type="WithResources.aspx">
<property name="Localizer" ref="localizer" />
</object>
<object type="WithoutResources.aspx">
<property name="Localizer" ref="localizer" />
</object>
<object id="localizer" type="Spring.Globalization.Localizers.ResourceSetLocalizer, Spring.Core" />
</objects>
</spring>
</configuration>

View File

@@ -0,0 +1,2 @@
<%@ Page language="c#" EnableSessionState="ReadOnly" AutoEventWireup="false" Inherits="Spring.Web.UI.Page" %>
<asp:Label ID="Result" runat="server" />

View File

@@ -0,0 +1,2 @@
<%@ Page language="c#" EnableSessionState="ReadOnly" AutoEventWireup="false" Inherits="Spring.Web.UI.Page" %>
<%="OK"%>

View File

@@ -127,6 +127,7 @@
<Compile Include="Web\UI\SessionModelPersistenceMediumTests.cs" />
<Compile Include="Web\UI\UserControlTests.cs" />
<None Include="Data\Spring\Context\Support\WebApplicationContextTests\Web.Config" />
<None Include="Data\Spring\Web\Support\LocalResourceManagerTests\Web.Config" />
<None Include="Data\Spring\Web\Support\PageHandlerFactoryTests\Web.Config.net-1.1" />
<None Include="Data\Spring\Web\Support\PageHandlerFactoryTests\Web.Config.net-2.0" />
<None Include="Spring.Web.Tests.build" />
@@ -135,12 +136,17 @@
<EmbeddedResource Include="Context\Support\HttpApplicationConfigurerTests.xml" />
<Content Include="Data\Spring\Context\Support\WebApplicationContextTests\Dummy.aspx" />
<Content Include="Data\Spring\Objects\Factory\Support\TestForm.aspx" />
<Content Include="Data\Spring\Web\Support\LocalResourceManagerTests\WithoutResources.aspx" />
<Content Include="Data\Spring\Web\Support\LocalResourceManagerTests\WithResources.aspx" />
<Content Include="Data\Spring\Web\Support\PageHandlerFactoryTests\ReadOnlySession.aspx" />
<Content Include="Data\Spring\Web\Support\PageHandlerFactoryTests\TransferAfterSetResult.aspx" />
<Content Include="Data\Spring\Web\Support\PageHandlerFactoryTests\MaintainsSession1.aspx" />
<Content Include="Data\Spring\Web\Support\PageHandlerFactoryTests\MaintainsSession2.aspx" />
<Content Include="Data\Spring\Web\Support\PageHandlerFactoryTests\DisablesSession.aspx" />
<Content Include="Data\Spring\Web\Support\PageHandlerFactoryTests\TransferAfterSetResultSave.aspx" />
<EmbeddedResource Include="Data\Spring\Web\Support\LocalResourceManagerTests\App_LocalResources\WithResources.aspx.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Web\Support\ControlInterceptionTests.objects.xml" />
</ItemGroup>
<ItemGroup>

View File

@@ -144,6 +144,7 @@
<Compile Include="Web\UI\UserControlTests.cs">
</Compile>
<None Include="Data\Spring\Context\Support\WebApplicationContextTests\Web.Config" />
<None Include="Data\Spring\Web\Support\LocalResourceManagerTests\Web.Config" />
<None Include="Data\Spring\Web\Support\PageHandlerFactoryTests\Web.Config.net-1.1" />
<None Include="Data\Spring\Web\Support\PageHandlerFactoryTests\Web.Config.net-2.0" />
<None Include="Spring.Web.Tests.build" />
@@ -152,11 +153,15 @@
<EmbeddedResource Include="Context\Support\HttpApplicationConfigurerTests.xml" />
<Content Include="Data\Spring\Context\Support\WebApplicationContextTests\Dummy.aspx" />
<Content Include="Data\Spring\Objects\Factory\Support\TestForm.aspx" />
<Content Include="Data\Spring\Web\Support\LocalResourceManagerTests\WithoutResources.aspx" />
<Content Include="Data\Spring\Web\Support\LocalResourceManagerTests\WithResources.aspx" />
<Content Include="Data\Spring\Web\Support\PageHandlerFactoryTests\ReadOnlySession.aspx" />
<Content Include="Data\Spring\Web\Support\PageHandlerFactoryTests\TransferAfterSetResult.aspx" />
<Content Include="Data\Spring\Web\Support\PageHandlerFactoryTests\MaintainsSession1.aspx" />
<Content Include="Data\Spring\Web\Support\PageHandlerFactoryTests\MaintainsSession2.aspx" />
<Content Include="Data\Spring\Web\Support\PageHandlerFactoryTests\DisablesSession.aspx" />
<Content Include="Data\Spring\Web\Support\PageHandlerFactoryTests\TransferAfterSetResultSave.aspx" />
<EmbeddedResource Include="Data\Spring\Web\Support\LocalResourceManagerTests\App_LocalResources\WithResources.aspx.resx" />
<EmbeddedResource Include="Web\Support\ControlInterceptionTests.objects.xml" />
</ItemGroup>
<ItemGroup>

View File

@@ -21,17 +21,38 @@
#region Imports
using System;
using NUnit.Framework;
using NUnitAspEx;
#endregion
#if NET_2_0
namespace Spring.Web.Support
{
/// <summary>
///
/// </summary>
/// <author>Erich Eichinger</author>
[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("<span id=\"Result\"></span>", result);
}
[Test]
public void ReturnsWithoutResources()
{
AspTestClient client = new AspTestClient();
string result = client.GetPage("WithoutResources.aspx");
Assert.AreEqual("OK", result);
}
}
}
}
#endif // NET_2_0