Author: atsushi
Date: 2008-02-15 09:34:55 -0500 (Fri, 15 Feb 2008)
New Revision: 95755

Added:
   
trunk/olive/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs
Modified:
   
trunk/olive/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog
   
trunk/olive/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointAddressMessageFilter.cs
   
trunk/olive/class/System.ServiceModel/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilter.cs
   trunk/olive/class/System.ServiceModel/System.ServiceModel_test.dll.sources
   
trunk/olive/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/ChangeLog
Log:
2008-02-15  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * EndpointAddressMessageFilter.cs : implement Match(MessageBuffer).
          Use ordinal string comparison.
        * PrefixEndpointAddressMessageFilter.cs : implement Match() (both).

        * PrefixEndpointAddressMessageFilterTest.cs : new test (not working).



Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog  
    2008-02-15 14:12:44 UTC (rev 95754)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog  
    2008-02-15 14:34:55 UTC (rev 95755)
@@ -1,3 +1,9 @@
+2008-02-15  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * EndpointAddressMessageFilter.cs : implement Match(MessageBuffer).
+         Use ordinal string comparison.
+       * PrefixEndpointAddressMessageFilter.cs : implement Match() (both).
+
 2008-02-14  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * EndpointDispatcher.cs : moved AddressFilter application only when

Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointAddressMessageFilter.cs
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointAddressMessageFilter.cs
        2008-02-15 14:12:44 UTC (rev 95754)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointAddressMessageFilter.cs
        2008-02-15 14:34:55 UTC (rev 95755)
@@ -67,19 +67,20 @@
                public override bool Match (Message message)
                {
                        Uri to = message.Headers.To;
-                       bool path = ((String.Compare (to.AbsolutePath, 
address.Uri.AbsolutePath) == 0) && 
+                       bool path = ((String.CompareOrdinal (to.AbsolutePath, 
address.Uri.AbsolutePath) == 0) && 
                                        (to.Port == address.Uri.Port));
                        bool host = IncludeHostNameInComparison
-                                       ? (String.Compare (to.Host, 
address.Uri.Host) == 0)
+                                       ? (String.CompareOrdinal (to.Host, 
address.Uri.Host) == 0)
                                        : true;
 
                        return path && host;
                }
 
-               [MonoTODO]
                public override bool Match (MessageBuffer messageBuffer)
                {
-                       throw new NotImplementedException ();
+                       if (messageBuffer == null)
+                               throw new ArgumentNullException 
("messageBuffer");
+                       return Match (messageBuffer.CreateMessage ());
                }
        }
 }

Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilter.cs
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilter.cs
  2008-02-15 14:12:44 UTC (rev 95754)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilter.cs
  2008-02-15 14:34:55 UTC (rev 95755)
@@ -26,6 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 using System;
+using System.Globalization;
 using System.ServiceModel.Channels;
 using System.ServiceModel;
 
@@ -66,13 +67,21 @@
                [MonoTODO]
                public override bool Match (Message message)
                {
-                       throw new NotImplementedException ();
+                       Uri to = message.Headers.To;
+                       bool path = 
((CultureInfo.InvariantCulture.CompareInfo.IsPrefix (to.AbsolutePath, 
address.Uri.AbsolutePath, CompareOptions.Ordinal)) && 
+                                       (to.Port == address.Uri.Port));
+                       bool host = IncludeHostNameInComparison
+                                       ? (String.CompareOrdinal (to.Host, 
address.Uri.Host) == 0)
+                                       : true;
+
+                       return path && host;
                }
 
-               [MonoTODO]
                public override bool Match (MessageBuffer messageBuffer)
                {
-                       throw new NotImplementedException ();
+                       if (messageBuffer == null)
+                               throw new ArgumentNullException 
("messageBuffer");
+                       return Match (messageBuffer.CreateMessage ());
                }
        }
 }

Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel_test.dll.sources
===================================================================
--- trunk/olive/class/System.ServiceModel/System.ServiceModel_test.dll.sources  
2008-02-15 14:12:44 UTC (rev 95754)
+++ trunk/olive/class/System.ServiceModel/System.ServiceModel_test.dll.sources  
2008-02-15 14:34:55 UTC (rev 95755)
@@ -54,6 +54,7 @@
 System.ServiceModel.Dispatcher/ExceptionHandlerTest.cs
 System.ServiceModel.Dispatcher/FilterTableTest.cs
 System.ServiceModel.Dispatcher/InvalidBodyAccessExceptionTest.cs
+System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs
 System.ServiceModel.PeerResolvers/CustomPeerResolverServiceTest.cs
 System.ServiceModel.Security.Tokens/IssuedSecurityTokenParametersTest.cs
 System.ServiceModel.Security.Tokens/IssuedSecurityTokenProviderTest.cs

Modified: 
trunk/olive/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/ChangeLog
===================================================================
--- 
trunk/olive/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/ChangeLog
 2008-02-15 14:12:44 UTC (rev 95754)
+++ 
trunk/olive/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/ChangeLog
 2008-02-15 14:34:55 UTC (rev 95755)
@@ -1,3 +1,7 @@
+2008-02-15  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * PrefixEndpointAddressMessageFilterTest.cs : new test (not working).
+
 2006-10-18  Ankit Jain  <[EMAIL PROTECTED]>
 
        * EndpointAddressMessageFilterTest.cs (Match): Add more tests.

Added: 
trunk/olive/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs
===================================================================
--- 
trunk/olive/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs
 2008-02-15 14:12:44 UTC (rev 95754)
+++ 
trunk/olive/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs
 2008-02-15 14:34:55 UTC (rev 95755)
@@ -0,0 +1,82 @@
+//
+// PrefixEndpointAddressMessageFilterTest.cs
+//
+// Author:
+//     Atsushi Enomoto <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2008 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.Collections.ObjectModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel;
+using System.ServiceModel.Description;
+using System.ServiceModel.Dispatcher;
+using NUnit.Framework;
+
+namespace MonoTests.System.ServiceModel.Dispatcher
+{
+       [TestFixture]
+       public class PrefixEndpointAddressMessageFilterTest
+       {
+               const string anonymous_uri = 
"http://www.w3.org/2005/08/addressing/anonymous";;
+
+               static Message CreateMessageWithTo (string to)
+               {
+                       return CreateMessageWithTo (new Uri (to));
+               }
+
+               static Message CreateMessageWithTo (Uri to)
+               {
+                       Message msg = Message.CreateMessage 
(MessageVersion.Default, "urn:myaction");
+                       msg.Headers.Add (MessageHeader.CreateHeader ("To", 
"http://www.w3.org/2005/08/addressing";, to));
+                       return msg;
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void Match ()
+               {
+                       PrefixEndpointAddressMessageFilter f =
+                               new PrefixEndpointAddressMessageFilter (new 
EndpointAddress ("http://localhost:8080";));
+                       Assert.IsTrue (f.Match (CreateMessageWithTo 
("http://localhost:8080";)), "#1");
+                       Assert.IsTrue (f.Match (CreateMessageWithTo (new Uri 
("http://localhost:8080";))), "#1-2");
+                       Assert.IsTrue (f.Match (CreateMessageWithTo 
(anonymous_uri)), "#2");
+                       Assert.IsTrue (f.Match (CreateMessageWithTo 
(EndpointAddress.AnonymousUri)), "#3");
+                       Assert.IsTrue (f.Match (CreateMessageWithTo 
(EndpointAddress.NoneUri)), "#4");
+                       // no To header
+                       Assert.IsFalse (f.Match (Message.CreateMessage 
(MessageVersion.Default, "urn:myaction")), "#5");
+                       
+                       Assert.IsTrue (f.Match (CreateMessageWithTo 
("http://10.1.1.1:8080";)), "#6");
+                       Assert.IsTrue (f.Match (CreateMessageWithTo 
("http://10.1.1.1:8081";)), "#7");
+
+                       f = new PrefixEndpointAddressMessageFilter (new 
EndpointAddress ("http://localhost:8080/abc";), true);
+                       Assert.IsFalse (f.Match (CreateMessageWithTo 
("http://127.0.0.2:8080/abc";)), "#8");
+
+                       Assert.IsTrue (f.Match (CreateMessageWithTo 
("http://localhost:8080/abc?wsdl";)), "#9");
+
+                       f = new PrefixEndpointAddressMessageFilter (new 
EndpointAddress ("http://localhost:8080/abc?foo";), true);
+                       Assert.IsTrue (f.Match (CreateMessageWithTo 
("http://localhost:8080/abc?wsdl";)), "#10");
+               }
+       }
+}


Property changes on: 
trunk/olive/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs
___________________________________________________________________
Name: svn:eol-style
   + native

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to