diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2010-01-22 18:05:11 +0300 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2010-01-22 18:05:11 +0300 |
commit | 440e862eaa5e597ef403404e3963c6d4d7681c55 (patch) | |
tree | aed48b9e5f9ae9674829fa6a2ae5930ef0d37cf3 | |
parent | 3dd68a17ca9ec168788bc9f2fd7d3fc8ef5f6d3f (diff) |
2010-01-22 Atsushi Enomoto <atsushi@ximian.com>
* ServiceHostBase.cs : fix complicated IMetadataExchange handling to
pass nunit tests (treat mex binding as special case).
* ServiceMetadataBehaviorTest.cs : check name constant (MSDN is
wrong here).
* ServiceHostTest.cs : add a few more comments.
svn path=/trunk/mcs/; revision=150066
6 files changed, 25 insertions, 18 deletions
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog index 1969b60f558..407a0030100 100755 --- a/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog +++ b/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog @@ -1,5 +1,10 @@ 2010-01-22 Atsushi Enomoto <atsushi@ximian.com> + * ServiceHostBase.cs : fix complicated IMetadataExchange handling to + pass nunit tests (treat mex binding as special case). + +2010-01-22 Atsushi Enomoto <atsushi@ximian.com> + * DuplexClientRuntimeChannel.cs : do not try to iterate channel acceptor when it is being closed. diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs index fe1ac72895f..f799f9a3cd7 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs @@ -197,7 +197,7 @@ namespace System.ServiceModel Uri address, Uri listenUri) { EndpointAddress ea = BuildEndpointAddress (address, binding); - ContractDescription cd = GetContract (implementedContract); + ContractDescription cd = GetContract (implementedContract, binding.Name == "MetadataExchangeHttpBinding"); if (cd == null) throw new InvalidOperationException (String.Format ("Contract '{0}' was not found in the implemented contracts in this service host.", implementedContract)); return AddServiceEndpointCore (cd, binding, ea, listenUri); @@ -218,7 +218,7 @@ namespace System.ServiceModel ContractDescription mex_contract, help_page_contract; - ContractDescription GetContract (string name) + ContractDescription GetContract (string name, bool mexBinding) { // FIXME: not sure if they should really be special cases. switch (name) { @@ -234,30 +234,19 @@ namespace System.ServiceModel // if it was added only IMetadataExchange // endpoint (and you'll see the word // "infrastructure" in the exception message). - if (Description.Behaviors.Find<ServiceMetadataBehavior> () == null) + if (mexBinding && Description.Behaviors.Find<ServiceMetadataBehavior> () == null) break; if (mex_contract == null) mex_contract = ContractDescription.GetContract (typeof (IMetadataExchange)); return mex_contract; } - // FIXME: probably type-to-contract-name mapping is wrong. - // This "loopup by type name" incorrectly allows - // "System.ServiceModel.Description.IMetadataExchange", - // but disabling this results in couple of regressions. - // So I keep enabling it so far. But it smells wrong. Type type = PopulateType (name); + if (type == null) + return null; foreach (ContractDescription cd in ImplementedContracts.Values) { - if (type == null) { - if (cd.Name == name) - return cd; - continue; - } - - // FIXME: This check is a negative side effect - // of the above hack. (but it should not still - // skip name-based match). Seealso above FIXMEs. + // This check is a negative side effect of the above match-by-name design. if (cd.ContractType == typeof (IMetadataExchange)) continue; diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ChangeLog b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ChangeLog index 840e3e2c395..e315e2b9f6f 100755 --- a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ChangeLog +++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ChangeLog @@ -1,3 +1,8 @@ +2010-01-22 Atsushi Enomoto <atsushi@ximian.com> + + * ServiceMetadataBehaviorTest.cs : check name constant (MSDN is + wrong here). + 2010-01-19 Atsushi Enomoto <atsushi@ximian.com> * ServiceAuthorizationBehaviorTest.cs : it's updated and enabled. diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ServiceMetadataBehaviorTest.cs b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ServiceMetadataBehaviorTest.cs index a33f7c3c2e7..0c96e32079a 100644 --- a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ServiceMetadataBehaviorTest.cs +++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ServiceMetadataBehaviorTest.cs @@ -265,6 +265,8 @@ namespace MonoTests.System.ServiceModel.Description Assert.IsNull (behavior.HttpsGetUrl, "HttpsGetUrl");
Assert.IsNotNull (behavior.MetadataExporter, "MetadataExporter #1");
Assert.AreEqual (typeof (WsdlExporter), behavior.MetadataExporter.GetType (), "MetadataExporter #2");
+
+ Assert.AreEqual ("IMetadataExchange", ServiceMetadataBehavior.MexContractName, "MexContractName");
}
}
}
diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel/ChangeLog b/mcs/class/System.ServiceModel/Test/System.ServiceModel/ChangeLog index 75ad0fa5ec0..07fe861963d 100755 --- a/mcs/class/System.ServiceModel/Test/System.ServiceModel/ChangeLog +++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel/ChangeLog @@ -1,5 +1,9 @@ 2010-01-22 Atsushi Enomoto <atsushi@ximian.com> + * ServiceHostTest.cs : add a few more comments. + +2010-01-22 Atsushi Enomoto <atsushi@ximian.com> + * CallbackBehaviorAttributeTest.cs : enable the test again. 2010-01-22 Atsushi Enomoto <atsushi@ximian.com> diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel/ServiceHostTest.cs b/mcs/class/System.ServiceModel/Test/System.ServiceModel/ServiceHostTest.cs index a469c8279eb..c3ef2365e9a 100644 --- a/mcs/class/System.ServiceModel/Test/System.ServiceModel/ServiceHostTest.cs +++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel/ServiceHostTest.cs @@ -161,7 +161,8 @@ namespace MonoTests.System.ServiceModel public void AddServiceEndpoint5 () { ServiceHost host = new ServiceHost (typeof (Baz), new Uri ("http://localhost/echo")); - // Full type name is expected here. + + // Full type name is expected here (see AddServiceEndpoint4). host.AddServiceEndpoint ("IBaz", new BasicHttpBinding (), "rel"); } @@ -187,6 +188,7 @@ namespace MonoTests.System.ServiceModel public void AddServiceEndpointMetadataExchange () { ServiceHost host = new ServiceHost (typeof (MyMetadataExchange)); + // strange, but unlike above, it is accepted. The only difference I can see is the binding name. host.AddServiceEndpoint ("IMetadataExchange", new BasicHttpBinding (), "http://localhost:8080"); |