فهرست منبع

2010-03-17 Atsushi Enomoto <[email protected]>

	* MetadataExchangeBindings.cs : use WSHttpBinding (it works if other
	  parts gets fixed).

	* MetadataExchangeBindingsTest.cs : new test.

	* System.ServiceModel_test.dll.sources :
	  add MetadataExchangeBindingsTest.cs.


svn path=/trunk/mcs/; revision=153762
Atsushi Eno 16 سال پیش
والد
کامیت
22b6b52b03

+ 5 - 0
mcs/class/System.ServiceModel/ChangeLog

@@ -1,3 +1,8 @@
+2010-03-17  Astushi Enomoto  <[email protected]>
+
+	* System.ServiceModel_test.dll.sources :
+	  add MetadataExchangeBindingsTest.cs.
+
 2010-03-16  Jb Evain  <[email protected]>
 
 	* net_2_1_*.dll.sources: rename to moonlight_*.dll.sources.

+ 5 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog

@@ -1,3 +1,8 @@
+2010-03-17  Atsushi Enomoto  <[email protected]>
+
+	* MetadataExchangeBindings.cs : use WSHttpBinding (it works if other
+	  parts gets fixed).
+
 2010-03-17  Atsushi Enomoto  <[email protected]>
 
 	* ServiceMetadataExtension.cs, WsdlExporter.cs :

+ 8 - 16
mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataExchangeBindings.cs

@@ -34,26 +34,18 @@ namespace System.ServiceModel.Description
 	{
 		public static Binding CreateMexHttpBinding ()
 		{
-			//FIXME: .net uses WSHttpBinding.. 
-			return new CustomBinding (
-				"MetadataExchangeHttpBinding",
-				"http://schemas.microsoft.com/ws/2005/02/mex/bindings",
-				new TextMessageEncodingBindingElement (
-					MessageVersion.Soap12WSAddressing10, 
-					Encoding.UTF8),
-				new HttpTransportBindingElement ());
+			var b = new WSHttpBinding (SecurityMode.None) {
+				Name = "MetadataExchangeHttpBinding",
+				Namespace = "http://schemas.microsoft.com/ws/2005/02/mex/bindings"};
+			return b;
 		}
 
 		public static Binding CreateMexHttpsBinding ()
 		{
-			//FIXME: .net uses WSHttpBinding.. 
-			return new CustomBinding (
-				"MetadataExchangeHttpsBinding",
-				"http://schemas.microsoft.com/ws/2005/02/mex/bindings",
-				new TextMessageEncodingBindingElement (
-					MessageVersion.Soap12WSAddressing10, 
-					Encoding.UTF8),
-				new HttpsTransportBindingElement ());
+			var b = (WSHttpBinding) CreateMexHttpBinding ();
+			b.Name = "MetadataExchangeHttpsBinding";
+			b.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
+			return b;
 		}
 
 		public static Binding CreateMexNamedPipeBinding ()

+ 1 - 0
mcs/class/System.ServiceModel/System.ServiceModel_test.dll.sources

@@ -67,6 +67,7 @@ System.ServiceModel.Configuration/StandardBindingElementTest.cs
 System.ServiceModel.Configuration/UserBinding.cs
 System.ServiceModel.Description/ClientCredentialsTest.cs
 System.ServiceModel.Description/ContractDescriptionTest.cs
+System.ServiceModel.Description/MetadataExchangeBindingsTest.cs
 System.ServiceModel.Description/MetadataResolverTest.cs
 System.ServiceModel.Description/OperationDescriptionTest.cs
 System.ServiceModel.Description/ServiceAuthorizationBehaviorTest.cs

+ 4 - 0
mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ChangeLog

@@ -1,3 +1,7 @@
+2010-03-17  Atsushi Enomoto  <[email protected]>
+
+	* MetadataExchangeBindingsTest.cs : new test.
+
 2010-02-10  Atsushi Enomoto  <[email protected]>
 
 	* WsdlImporterTest.cs : ignore whatever make dist broke.

+ 59 - 0
mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/MetadataExchangeBindingsTest.cs

@@ -0,0 +1,59 @@
+//
+// MetadataResolverTest.cs
+//
+// Author:
+//	Atsushi Enomoto  <[email protected]>
+//
+// Copyright (C) 2010 Novell, Inc.  http://www.novell.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Runtime.Serialization;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.ServiceModel.Description
+{
+	[TestFixture]
+	public class MetadataExchangeBindingsTest
+	{
+		[Test]
+		public void CreateMexHttpBinding ()
+		{
+			var b = MetadataExchangeBindings.CreateMexHttpBinding () as WSHttpBinding;
+			Assert.IsNotNull (b, "#1");
+			Assert.AreEqual (SecurityMode.None, b.Security.Mode, "#2");
+			Assert.IsFalse (b.TransactionFlow, "#3");
+			Assert.IsFalse (b.ReliableSession.Enabled, "#4");
+			Assert.IsFalse (b.CreateBindingElements ().Any (be => be is SecurityBindingElement), "#b1");
+			Assert.IsTrue (b.CreateBindingElements ().Any (be => be is TransactionFlowBindingElement), "#b2");
+			Assert.IsFalse (b.CreateBindingElements ().Any (be => be is ReliableSessionBindingElement), "#b3");
+			Assert.IsTrue (new TransactionFlowBindingElement ().TransactionProtocol == TransactionProtocol.Default, "#x1");
+		}
+	}
+}