[bcl] Remove the ValueAdd and InetAccess NUnit categories (#2212)
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Fri, 14 Jul 2017 21:38:31 +0000 (23:38 +0200)
committerGitHub <noreply@github.com>
Fri, 14 Jul 2017 21:38:31 +0000 (23:38 +0200)
ValueAdd was added over a decade ago and all the tests marked with this category are passing now.

We have *tons* of tests that rely on working DNS/Internet that aren't marked with
InetAccess (and they actually provide good value so we don't want to exclude them).

Since these categories don't really make sense and just causes confusion
it's better to just remove them.

18 files changed:
mcs/build/tests.make
mcs/class/System.DirectoryServices/Test/System.DirectoryServices/DirectoryServicesDirectoryEntryTest.cs
mcs/class/System.DirectoryServices/Test/System.DirectoryServices/DirectoryServicesDirectorySearcherTest.cs
mcs/class/System.DirectoryServices/Test/System.DirectoryServices/DirectoryServicesSearchResultTest.cs
mcs/class/System.Web.Services/Test/System.Web.Services.Discovery/DiscoveryClientProtocolTest.cs
mcs/class/System.Windows.Forms/Makefile
mcs/class/System/Test/System.Net.Sockets/NetworkStreamCas.cs
mcs/class/System/Test/System.Net.Sockets/SocketCas.cs
mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
mcs/class/System/Test/System.Net.Sockets/TcpClientCas.cs
mcs/class/System/Test/System.Net/HttpWebRequestTest.cs
mcs/class/System/Test/System.Net/ServicePointManagerTest.cs
mcs/class/System/Test/System.Net/ServicePointTest.cs
mcs/class/System/Test/System.Net/WebClientTest.cs
mcs/class/System/Test/System.Net/WebClientTestAsync.cs
mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X509ChainTest.cs
mcs/class/corlib/Test/System.Reflection.Emit/EnumBuilderTest.cs
msvc/mono-nunit-test.props

index 8874b32326aa3f87550a5ff3a863a1e5d5fd6b04..8ffa784a23aeff1661c912461451be8e75a5445e 100644 (file)
@@ -104,7 +104,7 @@ test-local: $(test_assemblies)
 run-test-local: run-test-lib
 run-test-ondotnet-local: run-test-ondotnet-lib
 
-TEST_HARNESS_EXCLUDES = -exclude=$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PROFILE_TEST_HARNESS_EXCLUDES)NotWorking,ValueAdd,CAS,InetAccess
+TEST_HARNESS_EXCLUDES = -exclude=$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PROFILE_TEST_HARNESS_EXCLUDES)NotWorking,CAS
 TEST_HARNESS_EXCLUDES_ONDOTNET = /exclude:$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PROFILE_TEST_HARNESS_EXCLUDES)NotDotNet,CAS
 
 NOSHADOW_FLAG =
index cecbc7e1fb0892054bb2788948f99a3974380b27..330a8d8a5e728bdb8ab00348d703a38f52a3385f 100644 (file)
@@ -13,7 +13,6 @@ using System.DirectoryServices;
 namespace MonoTests.System.DirectoryServices \r
 {\r
        [TestFixture]\r
-       [Category ("InetAccess")]\r
        public class DirectoryServicesDirectoryEntryTest\r
        {\r
                #region Fields\r
@@ -30,6 +29,9 @@ namespace MonoTests.System.DirectoryServices
                {\r
                        de = null;\r
                        configuration = new TestConfiguration ();\r
+\r
+                       if (String.IsNullOrEmpty (configuration.ConnectionString))\r
+                               Assert.Ignore ("No configuration");\r
                }\r
 \r
 \r
index 2775fcb7b4e2af125128843eb69d1a041551d821..95ce2662c54a5b5fbe1b9642e54ce748951e5e26 100644 (file)
@@ -15,7 +15,6 @@ using System.Threading;
 namespace MonoTests.System.DirectoryServices \r
 {\r
        [TestFixture]\r
-       [Category ("InetAccess")]\r
        public class DirectoryServicesDirectorySearcherTest\r
        {\r
                #region Fields\r
@@ -33,6 +32,9 @@ namespace MonoTests.System.DirectoryServices
                {\r
                        de = null;                      \r
                        configuration = new TestConfiguration ();\r
+\r
+                       if (String.IsNullOrEmpty (configuration.ConnectionString))\r
+                               Assert.Ignore ("No configuration");\r
                }\r
 \r
 \r
index 87f69ad7d0ff138216d1991b421ab9fa1ec73f4d..21aa253301b5a73722d6a4fa817cd9516535528e 100644 (file)
@@ -13,7 +13,6 @@ using System.DirectoryServices;
 namespace MonoTests.System.DirectoryServices \r
 {\r
        [TestFixture]\r
-       [Category ("InetAccess")]\r
        public class DirectoryServicesSearchResultTest\r
        {\r
                #region Fields\r
@@ -31,6 +30,9 @@ namespace MonoTests.System.DirectoryServices
                {\r
                        de = null;\r
                        configuration = new TestConfiguration ();\r
+\r
+                       if (String.IsNullOrEmpty (configuration.ConnectionString))\r
+                               Assert.Ignore ("No configuration");\r
                }\r
 \r
 \r
index 4a12ce5b1ea97ecf3111f850f7e9135baa3c52aa..13a357274aecf3e89de65469ed444693a5267593 100644 (file)
@@ -18,7 +18,7 @@ namespace MonoTests.System.Web.Services.Discovery {
        public class DiscoveryClientProtocolTest {
 
                [Test] // Covers #36116
-               [Category ("InetAccess")]
+               [Category ("NotWorking")]
                public void ReadWriteTest ()
                {
                        string directory = Path.Combine (Path.GetTempPath (), Path.GetRandomFileName ());
index 0e4fb4ef46d1bc097411a2d11d8aa3550585f207..e9802b1859046fb6330065cf9fbd0e698d1330b9 100644 (file)
@@ -114,7 +114,7 @@ test-local: DummyAssembly.dll
 
 include ../../build/library.make
 
-TEST_HARNESS_EXCLUDES = -exclude=Interactive,NotWorking,ValueAdd,CAS,InetAccess
+TEST_HARNESS_EXCLUDES = -exclude=Interactive,NotWorking,CAS
 TEST_HARNESS_EXCLUDES_ONDOTNET = -exclude=Interactive,NotDotNet,CAS
 
 $(the_lib): $(RESOURCES)
index 6747a263a6c966a549438d4989be1961db90cc6b..3e33097d1fc133548088677bc5ab6ccdce8c99f0 100644 (file)
@@ -97,7 +97,6 @@ namespace MonoCasTests.System.Net.Sockets {
 
                [Test]
                [EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
-               [Category ("InetAccess")]
                public void AsyncRead ()
                {
                        message = "AsyncRead";
@@ -136,7 +135,6 @@ namespace MonoCasTests.System.Net.Sockets {
 
                [Test]
                [EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
-               [Category ("InetAccess")]
                public void AsyncWrite ()
                {
                        message = "AsyncWrite";
index 6319d3e7b941976addc7b3462c8ee1c73a497f6a..1b4458c4f137b0bad9a7653468030029bcb49082 100644 (file)
@@ -78,7 +78,6 @@ namespace MonoCasTests.System.Net.Sockets {
 
                [Test]
                [EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
-               [Category ("InetAccess")]
                public void AsyncAccept ()
                {
                        IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 16279);
@@ -118,7 +117,6 @@ namespace MonoCasTests.System.Net.Sockets {
 
                [Test]
                [EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
-               [Category ("InetAccess")]
                public void AsyncConnect ()
                {
                        message = "AsyncConnect";
@@ -152,7 +150,6 @@ namespace MonoCasTests.System.Net.Sockets {
 
                [Test]
                [EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
-               [Category ("InetAccess")]
                public void AsyncReceive ()
                {
                        message = "AsyncReceive";
@@ -191,7 +188,6 @@ namespace MonoCasTests.System.Net.Sockets {
 
                [Test]
                [EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
-               [Category ("InetAccess")]
                public void AsyncReceiveFrom ()
                {
                        message = "AsyncReceiveFrom";
@@ -230,7 +226,6 @@ namespace MonoCasTests.System.Net.Sockets {
 
                [Test]
                [EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
-               [Category ("InetAccess")]
                public void AsyncSend ()
                {
                        message = "AsyncSend";
@@ -265,7 +260,6 @@ namespace MonoCasTests.System.Net.Sockets {
 
                [Test]
                [EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
-               [Category ("InetAccess")]
                public void AsyncSendTo ()
                {
                        message = "AsyncSendTo";
index d46838a9bb220d763682becc4f31d7f148fa8578..9a24b95e1b1642201544691b3af094e39acc17af 100755 (executable)
@@ -87,7 +87,7 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
-               [Category ("InetAccess")]
+               [Category ("NotWorking")]
 #if FEATURE_NO_BSD_SOCKETS
                [ExpectedException (typeof (PlatformNotSupportedException))]
 #endif
index b9f4de5440076d48ee56bc3aaa816e579f493081..fbc08e1f0f56762c7fc39e5c3945e6343e8d3f10 100644 (file)
@@ -50,7 +50,6 @@ namespace MonoCasTests.System.Net.Sockets {
                }
 
                // async tests (for stack propagation)
-/* Oops - not yet implemented in Mono
                private void ConnectCallback (IAsyncResult ar)
                {
                        TcpClient c = (TcpClient)ar.AsyncState;
@@ -71,7 +70,6 @@ namespace MonoCasTests.System.Net.Sockets {
 
                [Test]
                [EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
-               [Category ("InetAccess")]
                public void AsyncConnect_StringIntAsyncCallbackObject ()
                {
                        TcpClient s = new TcpClient ();
@@ -86,7 +84,6 @@ namespace MonoCasTests.System.Net.Sockets {
 
                [Test]
                [EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
-               [Category ("InetAccess")]
                public void AsyncConnect_IPAddressIntAsyncCallbackObject ()
                {
                        IPHostEntry host = Dns.Resolve ("www.google.com");
@@ -102,7 +99,6 @@ namespace MonoCasTests.System.Net.Sockets {
 
                [Test]
                [EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
-               [Category ("InetAccess")]
                public void AsyncConnect_IPAddressArrayIntAsyncCallbackObject ()
                {
                        IPHostEntry host = Dns.Resolve ("www.google.com");
@@ -115,6 +111,5 @@ namespace MonoCasTests.System.Net.Sockets {
                                Assert.Ignore ("Timeout");
                        Assert.IsNull (message, message);
                }
-*/
        }
 }
index 258e267787dd41137596051c3011569444c64ed2..38359efd4dea398ec4208a18de96c46569ccbac1 100644 (file)
@@ -63,7 +63,6 @@ namespace MonoTests.System.Net
                }
 
                [Test]
-               [Category("InetAccess")]
 #if FEATURE_NO_BSD_SOCKETS
                [ExpectedException (typeof (PlatformNotSupportedException))]
 #endif
@@ -135,7 +134,6 @@ namespace MonoTests.System.Net
                }
 
                [Test]
-               //[Category("InetAccess")]
                [Category ("NotWorking")] // Disabled until a server that meets requirements is found
                public void Cookies1 ()
                {
index c252d21b189bcd75d3c8b9cb2e94f621208fc838..2ed577e5df80d09d71c9fbd9e3329c783d40c56f 100644 (file)
@@ -47,7 +47,7 @@ public class ServicePointManagerTest
        }\r
 \r
         [Test, ExpectedException (typeof (InvalidOperationException))]\r
-               [Category ("InetAccess")]\r
+               [Category ("NotWorking")]\r
         public void MaxServicePointManagers ()\r
         {\r
                Assert.AreEqual (0, ServicePointManager.MaxServicePoints, "#1");\r
index 6171a2fd25587d85a535b496111aa114628536e0..514e27d47795e4279116888144c8caa4c4735dd3 100644 (file)
-//\r
-// ServicePointTest.cs - NUnit Test Cases for System.Net.ServicePoint\r
-//\r
-// Authors:\r
-//   Lawrence Pit (loz@cable.a2000.nl)\r
-//   Martin Willemoes Hansen (mwh@sysrq.dk)\r
-//\r
-// (C) 2003 Martin Willemoes Hansen\r
-//\r
-\r
-using NUnit.Framework;\r
-using System;\r
-using System.Collections;\r
-using System.IO;\r
-using System.Net;\r
-using System.Reflection;\r
-using System.Threading;\r
-\r
-namespace MonoTests.System.Net\r
-{\r
-\r
-[TestFixture]\r
-public class ServicePointTest\r
-{\r
-       static private int max;\r
-\r
-#if !FEATURE_NO_BSD_SOCKETS\r
-       [SetUp]\r
-       public void SaveMax () {\r
-               max = ServicePointManager.MaxServicePoints;\r
-               ServicePointManager.MaxServicePoints = 0;\r
-       }\r
-\r
-       [TearDown]\r
-       public void RestoreMax () {\r
-               ServicePointManager.MaxServicePoints = max;\r
-       }\r
-#endif\r
-\r
-        [Test]\r
-               [Category ("InetAccess")]\r
-        public void All ()\r
-        {\r
-               ServicePoint p = ServicePointManager.FindServicePoint (new Uri ("mailto:xx@yyy.com"));\r
-               //WriteServicePoint ("A servicepoint that isn't really", p);                    \r
-               \r
-               ServicePointManager.MaxServicePoints = 2;\r
-               ServicePoint google = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com"));\r
-               try {                   \r
-                       ServicePoint slashdot = ServicePointManager.FindServicePoint (new Uri ("http://www.slashdot.org"));\r
-                       Assert.Fail ("#1");\r
-               } catch (InvalidOperationException) { }\r
-               ServicePointManager.MaxServicePoints = 0;\r
-               \r
-               //WriteServicePoint ("google before getting a webrequest", google);\r
-               \r
-               HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");\r
-               HttpWebResponse res = (HttpWebResponse) req.GetResponse ();                     \r
-               \r
-#if FOUND_SOME_OTHER_URL\r
-               // URL is no longer found, disabled the test until a more reliable URL is found :P\r
-               //WriteServicePoint ("google after getting a response", google);\r
-               ServicePoint google2 = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com/dilbert.html"));\r
-               Assert.AreEqual (google, google2, "#equals");\r
-               res.Close ();\r
-#endif\r
-               \r
-               // in both instances property CurrentConnections is 0 according to ms.net.\r
-               // let's see what it says when we do async operations...\r
-               \r
-               HttpWebRequest req2 = (HttpWebRequest) WebRequest.Create ("http://www.google.com");\r
-               req2.Method = "PUT";\r
-               IAsyncResult async = req2.BeginGetRequestStream (null, null);\r
-               //WriteServicePoint ("after async BeginGetRequestStream", google);\r
-               // CurrentConnections: 1\r
-               Stream stream2 = req2.EndGetRequestStream (async);\r
-               //WriteServicePoint ("after async EndGetRequestStream", google);\r
-               // CurrentConnections: 1\r
-               stream2.Close ();\r
-               \r
-               req2 = (HttpWebRequest) WebRequest.Create ("http://www.google.com");\r
-               async = req2.BeginGetResponse (null, null);\r
-               //WriteServicePoint ("after async BeginGetResponse", google);\r
-               // CurrentConnections: 2\r
-               WebResponse res2 = req2.EndGetResponse (async);\r
-               //WriteServicePoint ("after async EndGetResponse", google);\r
-               // CurrentConnections: 0                        \r
-               // curious that after you get the webresponse object CurrentConnections is set to 0.\r
-               // you'd think that you'd still be connected until you close the webresponse..\r
-               //Console.WriteLine ("ContentLength: " + res2.ContentLength);\r
-               res2.Close ();\r
-               \r
-               ServicePoint sp2;\r
-#if FOUND_SOME_OTHER_URL\r
-               // unless of course some buffering is taking place.. let's check\r
-               Uri uri2 = new Uri ("http://freedesktop.org/Software/pkgconfig/releases/pkgconfig-0.15.0.tar.gz");\r
-               sp2 = ServicePointManager.FindServicePoint (uri2);\r
-               req2 = (HttpWebRequest) WebRequest.Create (uri2);\r
-               async = req2.BeginGetResponse (null, null);\r
-               //WriteServicePoint ("Large file: after async BeginGetResponse", sp2);\r
-               // CurrentConnections: 1\r
-               res2 = req2.EndGetResponse (async);\r
-               //WriteServicePoint ("Large file: after async EndGetResponse", sp2);\r
-               // CurrentConnections: 1\r
-               // and so it shows\r
-               //Console.WriteLine ("ContentLength: " + res2.ContentLength);\r
-               res2.Close ();\r
-#endif\r
-               \r
-               \r
-               // what's the limit of the cache?\r
-               req2 = (HttpWebRequest) WebRequest.Create ("http://www.apache.org/");\r
-               res2 = req2.GetResponse ();\r
-               sp2 = ServicePointManager.FindServicePoint (new Uri("http://www.apache.org/"));\r
-               //WriteServicePoint ("apache", sp2);\r
-               //Console.WriteLine ("ContentLength: " + res2.ContentLength);\r
-               // CurrentConnections: 1\r
-               res2.Close ();\r
-               // curious other effect: address is actually the full Uri of the previous request\r
-               // anyways, buffer is probably 4096 bytes\r
-       }\r
-\r
-       // try getting the stream to 5 web response objects     \r
-       // while ConnectionLimit equals 2\r
-\r
-       [Test]\r
-       [Category ("InetAccess")]\r
-       public void ConnectionLimit ()\r
-       {               \r
-               // the default is already 2, just in case it isn't..\r
-               ServicePointManager.DefaultConnectionLimit = 5;\r
-               \r
-               Uri uri = new Uri ("http://www.go-mono.com/");\r
-               ServicePoint sp = ServicePointManager.FindServicePoint (uri);                   \r
-               WebResponse [] res = new WebResponse [5];\r
-               for (int i = 0; i < 5; i++) {\r
-                       //Console.WriteLine ("GOT1 : " + i);\r
-                       HttpWebRequest req = (HttpWebRequest) WebRequest.Create (uri);\r
-                       //Console.WriteLine ("GOT2 : " + i);\r
-                       res [i] = req.GetResponse ();\r
-                       //WriteServicePoint ("after getting " + (i + 1) + " web response objects", sp);\r
-               }\r
-               \r
-               for (int i = 0; i < 5; i++) {\r
-                       Stream stream = res [i].GetResponseStream();\r
-                       //Console.WriteLine ("Reading stream: " + i + " : " + stream);\r
-                       int len = 0;\r
-                       while (stream.ReadByte () != -1)\r
-                               len++;\r
-                       //Console.WriteLine ("Finished reading: " + len + " bytes");\r
-               }\r
-               \r
-               for (int i = 0; i < 5; i++) {\r
-                       res [i].Close ();\r
-               }\r
-       }\r
-\r
-       [Test]\r
-       [Category ("InetAccess")]\r
-       [Category ("AndroidNotWorking")] // #A1 fails\r
-       public void EndPointBind ()\r
-       {\r
-               Uri uri = new Uri ("http://www.go-mono.com/");\r
-               ServicePoint sp = ServicePointManager.FindServicePoint (uri);\r
-\r
-               HttpWebRequest req = (HttpWebRequest) WebRequest.Create (uri);\r
-\r
-               bool called = false;\r
-               sp.BindIPEndPointDelegate = delegate {\r
-                       Assert.IsTrue (!called);\r
-                       called = true;\r
-                       return null;\r
-               };\r
-               req.GetResponse ().Close ();\r
-\r
-               Assert.IsTrue (called, "#A1");\r
-\r
-               req = (HttpWebRequest) WebRequest.Create (uri);\r
-               called = false;\r
-               sp.BindIPEndPointDelegate = delegate(ServicePoint point, IPEndPoint remote, int times) {\r
-                       Assert.IsTrue (times < 5);\r
-                       called = true;\r
-                       return new IPEndPoint(IPAddress.Parse("0.0.0.0"), 12345 + times);\r
-               };\r
-               req.GetResponse ().Close ();\r
-\r
-               Assert.IsTrue (called, "#A2");\r
-       }\r
-\r
-       public static void GetRequestStreamCallback (IAsyncResult asynchronousResult)\r
-       {\r
-       }\r
-\r
-       [Test] //Covers #19823\r
-#if FEATURE_NO_BSD_SOCKETS\r
-       // This test uses HttpWebRequest\r
-       [ExpectedException (typeof (PlatformNotSupportedException))]\r
-#endif\r
-       public void CloseConnectionGroupConcurency ()\r
-       {\r
-               // Try with multiple service points\r
-               for (var i = 0; i < 10; i++) {\r
-                       Uri targetUri = new Uri ("http://" + i + ".mono-project.com");\r
-                       var req = (HttpWebRequest) HttpWebRequest.Create (targetUri);\r
-                       req.ContentType = "application/x-www-form-urlencoded";\r
-                       req.Method = "POST";\r
-                       req.ConnectionGroupName = "" + i;\r
-                       req.ServicePoint.MaxIdleTime = 1;\r
-\r
-                       req.BeginGetRequestStream (new AsyncCallback (GetRequestStreamCallback), req);\r
-                       Thread.Sleep (1);\r
-                       req.ServicePoint.CloseConnectionGroup (req.ConnectionGroupName);\r
-               }\r
-       }\r
-\r
-\r
-       [Test]\r
-       [Category ("RequiresBSDSockets")] // Tests internals, so it doesn't make sense to assert that PlatformNotSupportedExceptions are thrown.\r
-       public void DnsRefreshTimeout ()\r
-       {\r
-               const int dnsRefreshTimeout = 2000;\r
-\r
-               ServicePoint sp;\r
-               IPHostEntry host0, host1, host2;\r
-               Uri uri;\r
-               PropertyInfo hostEntryProperty;\r
-\r
-               ServicePointManager.DnsRefreshTimeout = dnsRefreshTimeout;\r
-\r
-               uri = new Uri ("http://localhost/");\r
-               sp = ServicePointManager.FindServicePoint (uri);\r
-\r
-               hostEntryProperty = typeof (ServicePoint).GetProperty ("HostEntry", BindingFlags.NonPublic | BindingFlags.Instance);\r
-\r
-               host0 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;\r
-               host1 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;\r
-\r
-               Assert.AreSame (host0, host1, "HostEntry should result in the same IPHostEntry object.");\r
-\r
-               Thread.Sleep (dnsRefreshTimeout * 2);\r
-               host2 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;\r
-\r
-               Assert.AreNotSame(host0, host2, "HostEntry should result in a new IPHostEntry " +\r
-                               "object when DnsRefreshTimeout is reached.");\r
-       }\r
-\r
-// Debug code not used now, but could be useful later\r
-/*\r
-       private void WriteServicePoint (string label, ServicePoint sp)\r
-       {\r
-               Console.WriteLine ("\n" + label);\r
-               Console.WriteLine ("Address: " + sp.Address);\r
-               Console.WriteLine ("ConnectionLimit: " + sp.ConnectionLimit);\r
-               Console.WriteLine ("ConnectionName: " + sp.ConnectionName);\r
-               Console.WriteLine ("CurrentConnections: " + sp.CurrentConnections);\r
-               Console.WriteLine ("IdleSince: " + sp.IdleSince);\r
-               Console.WriteLine ("MaxIdletime: " + sp.MaxIdleTime);\r
-               Console.WriteLine ("ProtocolVersion: " + sp.ProtocolVersion);\r
-               Console.WriteLine ("SupportsPipelining: " + sp.SupportsPipelining);             \r
-       }\r
-*/\r
-}\r
-}\r
-\r
+//
+// ServicePointTest.cs - NUnit Test Cases for System.Net.ServicePoint
+//
+// Authors:
+//   Lawrence Pit (loz@cable.a2000.nl)
+//   Martin Willemoes Hansen (mwh@sysrq.dk)
+//
+// (C) 2003 Martin Willemoes Hansen
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.IO;
+using System.Net;
+using System.Reflection;
+using System.Threading;
+
+namespace MonoTests.System.Net
+{
+
+[TestFixture]
+public class ServicePointTest
+{
+       static private int max;
+
+#if !FEATURE_NO_BSD_SOCKETS
+       [SetUp]
+       public void SaveMax () {
+               max = ServicePointManager.MaxServicePoints;
+               ServicePointManager.MaxServicePoints = 0;
+       }
+
+       [TearDown]
+       public void RestoreMax () {
+               ServicePointManager.MaxServicePoints = max;
+       }
+#endif
+
+        [Test]
+               [Category ("NotWorking")]
+        public void All ()
+        {
+               ServicePoint p = ServicePointManager.FindServicePoint (new Uri ("mailto:xx@yyy.com"));
+               //WriteServicePoint ("A servicepoint that isn't really", p);                    
+               
+               ServicePointManager.MaxServicePoints = 2;
+               ServicePoint google = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com"));
+               try {                   
+                       ServicePoint slashdot = ServicePointManager.FindServicePoint (new Uri ("http://www.slashdot.org"));
+                       Assert.Fail ("#1");
+               } catch (InvalidOperationException) { }
+               ServicePointManager.MaxServicePoints = 0;
+               
+               //WriteServicePoint ("google before getting a webrequest", google);
+               
+               HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
+               HttpWebResponse res = (HttpWebResponse) req.GetResponse ();                     
+               
+#if FOUND_SOME_OTHER_URL
+               // URL is no longer found, disabled the test until a more reliable URL is found :P
+               //WriteServicePoint ("google after getting a response", google);
+               ServicePoint google2 = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com/dilbert.html"));
+               Assert.AreEqual (google, google2, "#equals");
+               res.Close ();
+#endif
+               
+               // in both instances property CurrentConnections is 0 according to ms.net.
+               // let's see what it says when we do async operations...
+               
+               HttpWebRequest req2 = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
+               req2.Method = "PUT";
+               IAsyncResult async = req2.BeginGetRequestStream (null, null);
+               //WriteServicePoint ("after async BeginGetRequestStream", google);
+               // CurrentConnections: 1
+               Stream stream2 = req2.EndGetRequestStream (async);
+               //WriteServicePoint ("after async EndGetRequestStream", google);
+               // CurrentConnections: 1
+               stream2.Close ();
+               
+               req2 = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
+               async = req2.BeginGetResponse (null, null);
+               //WriteServicePoint ("after async BeginGetResponse", google);
+               // CurrentConnections: 2
+               WebResponse res2 = req2.EndGetResponse (async);
+               //WriteServicePoint ("after async EndGetResponse", google);
+               // CurrentConnections: 0                        
+               // curious that after you get the webresponse object CurrentConnections is set to 0.
+               // you'd think that you'd still be connected until you close the webresponse..
+               //Console.WriteLine ("ContentLength: " + res2.ContentLength);
+               res2.Close ();
+               
+               ServicePoint sp2;
+#if FOUND_SOME_OTHER_URL
+               // unless of course some buffering is taking place.. let's check
+               Uri uri2 = new Uri ("http://freedesktop.org/Software/pkgconfig/releases/pkgconfig-0.15.0.tar.gz");
+               sp2 = ServicePointManager.FindServicePoint (uri2);
+               req2 = (HttpWebRequest) WebRequest.Create (uri2);
+               async = req2.BeginGetResponse (null, null);
+               //WriteServicePoint ("Large file: after async BeginGetResponse", sp2);
+               // CurrentConnections: 1
+               res2 = req2.EndGetResponse (async);
+               //WriteServicePoint ("Large file: after async EndGetResponse", sp2);
+               // CurrentConnections: 1
+               // and so it shows
+               //Console.WriteLine ("ContentLength: " + res2.ContentLength);
+               res2.Close ();
+#endif
+               
+               
+               // what's the limit of the cache?
+               req2 = (HttpWebRequest) WebRequest.Create ("http://www.apache.org/");
+               res2 = req2.GetResponse ();
+               sp2 = ServicePointManager.FindServicePoint (new Uri("http://www.apache.org/"));
+               //WriteServicePoint ("apache", sp2);
+               //Console.WriteLine ("ContentLength: " + res2.ContentLength);
+               // CurrentConnections: 1
+               res2.Close ();
+               // curious other effect: address is actually the full Uri of the previous request
+               // anyways, buffer is probably 4096 bytes
+       }
+
+       // try getting the stream to 5 web response objects     
+       // while ConnectionLimit equals 2
+
+       [Test]
+       [Category ("NotWorking")]
+       public void ConnectionLimit ()
+       {               
+               // the default is already 2, just in case it isn't..
+               ServicePointManager.DefaultConnectionLimit = 5;
+               
+               Uri uri = new Uri ("http://www.go-mono.com/");
+               ServicePoint sp = ServicePointManager.FindServicePoint (uri);                   
+               WebResponse [] res = new WebResponse [5];
+               for (int i = 0; i < 5; i++) {
+                       //Console.WriteLine ("GOT1 : " + i);
+                       HttpWebRequest req = (HttpWebRequest) WebRequest.Create (uri);
+                       //Console.WriteLine ("GOT2 : " + i);
+                       res [i] = req.GetResponse ();
+                       //WriteServicePoint ("after getting " + (i + 1) + " web response objects", sp);
+               }
+               
+               for (int i = 0; i < 5; i++) {
+                       Stream stream = res [i].GetResponseStream();
+                       //Console.WriteLine ("Reading stream: " + i + " : " + stream);
+                       int len = 0;
+                       while (stream.ReadByte () != -1)
+                               len++;
+                       //Console.WriteLine ("Finished reading: " + len + " bytes");
+               }
+               
+               for (int i = 0; i < 5; i++) {
+                       res [i].Close ();
+               }
+       }
+
+       [Test]
+       [Category ("NotWorking")] // #A1 fails
+       public void EndPointBind ()
+       {
+               Uri uri = new Uri ("http://www.go-mono.com/");
+               ServicePoint sp = ServicePointManager.FindServicePoint (uri);
+
+               HttpWebRequest req = (HttpWebRequest) WebRequest.Create (uri);
+
+               bool called = false;
+               sp.BindIPEndPointDelegate = delegate {
+                       Assert.IsTrue (!called);
+                       called = true;
+                       return null;
+               };
+               req.GetResponse ().Close ();
+
+               Assert.IsTrue (called, "#A1");
+
+               req = (HttpWebRequest) WebRequest.Create (uri);
+               called = false;
+               sp.BindIPEndPointDelegate = delegate(ServicePoint point, IPEndPoint remote, int times) {
+                       Assert.IsTrue (times < 5);
+                       called = true;
+                       return new IPEndPoint(IPAddress.Parse("0.0.0.0"), 12345 + times);
+               };
+               req.GetResponse ().Close ();
+
+               Assert.IsTrue (called, "#A2");
+       }
+
+       public static void GetRequestStreamCallback (IAsyncResult asynchronousResult)
+       {
+       }
+
+       [Test] //Covers #19823
+#if FEATURE_NO_BSD_SOCKETS
+       // This test uses HttpWebRequest
+       [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+       public void CloseConnectionGroupConcurency ()
+       {
+               // Try with multiple service points
+               for (var i = 0; i < 10; i++) {
+                       Uri targetUri = new Uri ("http://" + i + ".mono-project.com");
+                       var req = (HttpWebRequest) HttpWebRequest.Create (targetUri);
+                       req.ContentType = "application/x-www-form-urlencoded";
+                       req.Method = "POST";
+                       req.ConnectionGroupName = "" + i;
+                       req.ServicePoint.MaxIdleTime = 1;
+
+                       req.BeginGetRequestStream (new AsyncCallback (GetRequestStreamCallback), req);
+                       Thread.Sleep (1);
+                       req.ServicePoint.CloseConnectionGroup (req.ConnectionGroupName);
+               }
+       }
+
+
+       [Test]
+       [Category ("RequiresBSDSockets")] // Tests internals, so it doesn't make sense to assert that PlatformNotSupportedExceptions are thrown.
+       public void DnsRefreshTimeout ()
+       {
+               const int dnsRefreshTimeout = 2000;
+
+               ServicePoint sp;
+               IPHostEntry host0, host1, host2;
+               Uri uri;
+               PropertyInfo hostEntryProperty;
+
+               ServicePointManager.DnsRefreshTimeout = dnsRefreshTimeout;
+
+               uri = new Uri ("http://localhost/");
+               sp = ServicePointManager.FindServicePoint (uri);
+
+               hostEntryProperty = typeof (ServicePoint).GetProperty ("HostEntry", BindingFlags.NonPublic | BindingFlags.Instance);
+
+               host0 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;
+               host1 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;
+
+               Assert.AreSame (host0, host1, "HostEntry should result in the same IPHostEntry object.");
+
+               Thread.Sleep (dnsRefreshTimeout * 2);
+               host2 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;
+
+               Assert.AreNotSame(host0, host2, "HostEntry should result in a new IPHostEntry " +
+                               "object when DnsRefreshTimeout is reached.");
+       }
+
+// Debug code not used now, but could be useful later
+/*
+       private void WriteServicePoint (string label, ServicePoint sp)
+       {
+               Console.WriteLine ("\n" + label);
+               Console.WriteLine ("Address: " + sp.Address);
+               Console.WriteLine ("ConnectionLimit: " + sp.ConnectionLimit);
+               Console.WriteLine ("ConnectionName: " + sp.ConnectionName);
+               Console.WriteLine ("CurrentConnections: " + sp.CurrentConnections);
+               Console.WriteLine ("IdleSince: " + sp.IdleSince);
+               Console.WriteLine ("MaxIdletime: " + sp.MaxIdleTime);
+               Console.WriteLine ("ProtocolVersion: " + sp.ProtocolVersion);
+               Console.WriteLine ("SupportsPipelining: " + sp.SupportsPipelining);             
+       }
+*/
+}
+}
+
index d1f3180a2262510893243deb3f543919d6fe35b0..697eb82b6fd56ca29bac27cfba10ccdeb3368ad1 100644 (file)
@@ -43,7 +43,6 @@ namespace MonoTests.System.Net
                }
 
                [Test]
-               [Category ("InetAccess")]
                public void DownloadTwice ()
                {
                        WebClient wc = new WebClient();
index 0b404581899f7cdd81bb2421c0ac1f5e537a022d..205cb90a8dd7b3ece5cb9a7bb6d8998efeb32e2f 100644 (file)
@@ -79,7 +79,6 @@ namespace MonoTests.System.Net
                }
 
                [Test]
-               [Category("InetAccess")]
                public void DownloadFileTaskAsync ()
                {
                        WebClient wc = new WebClient ();
@@ -93,8 +92,7 @@ namespace MonoTests.System.Net
                }
 
                [Test]
-               [Category("InetAccess")]
-               [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+               [Category ("NotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
                public void Cancellation ()
                {
                        WebClient wc = new WebClient ();
@@ -121,8 +119,7 @@ namespace MonoTests.System.Net
                }
 
                [Test]
-               [Category("InetAccess")]
-               [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+               [Category ("NotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
                public void DownloadMultiple ()
                {
                        WebClient wc = new WebClient ();
@@ -140,8 +137,7 @@ namespace MonoTests.System.Net
                }
 
                [Test]
-               [Category("InetAccess")]
-               [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+               [Category ("NotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
                public void DownloadMultiple2 ()
                {
                        WebClient wc = new WebClient ();
@@ -153,8 +149,7 @@ namespace MonoTests.System.Net
                }
 
                [Test]
-               [Category("InetAccess")]
-               [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+               [Category ("NotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
                public void DownloadMultiple3 ()
                {
                        WebClient wc = new WebClient ();
index 026cfc2757aff97d39df4cd71631d8be4c5315de..1a3c6fe43ccdcd60018641e29cc3afe7fc843ac4 100644 (file)
@@ -205,7 +205,6 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
                }
 
                [Test]
-               [Category ("InetAccess")]
                public void Build_Cert1_X509RevocationMode_Online ()
                {
                        X509Chain c = new X509Chain ();
index e4fe1f52e88e6f85f4c5b55d48f273072940c1a5..124f59ef3b9f2b22fccdfa67399abdec51ca7374 100644 (file)
@@ -41,16 +41,6 @@ namespace MonoTests.System.Reflection.Emit
                        Assert.IsNull (enumBuilder.DeclaringType, "#3");
                        Assert.IsNull (enumBuilder.ReflectedType, "#4");
                        Assert.AreEqual (_enumType, enumBuilder.UnderlyingSystemType, "#5");
-               }
-
-               [Test]
-               [Category ("ValueAdd")]
-               public void TestEnumBuilder_NotInMono ()
-               {
-                       // If we decide to fix this (I dont see why we should),
-                       // move to the routine above
-
-                       EnumBuilder enumBuilder = GenerateEnum ();
                        Assert.IsFalse (enumBuilder.IsSerializable);
                }
 
@@ -187,7 +177,6 @@ namespace MonoTests.System.Reflection.Emit
 
                [Test]
                [ExpectedException (typeof (NotSupportedException))]
-               [Category ("ValueAdd")]
                public void TestFindMembersIncomplete ()
                {
                        EnumBuilder enumBuilder = GenerateEnum ();
@@ -229,7 +218,6 @@ namespace MonoTests.System.Reflection.Emit
 
                [Test]
                [ExpectedException (typeof (NotSupportedException))]
-               [Category ("ValueAdd")]
                public void TestGetConstructorIncomplete ()
                {
                        EnumBuilder enumBuilder = GenerateEnum ();
index 5c3c2b7a83c7f0884b40f003008aa0c206006449..b5e2a1f479362ffd292f2946dda3cfb990a9f71e 100644 (file)
@@ -7,7 +7,7 @@
     <MONO_CFG_DIR>$(MONO_DIR)/runtime/etc</MONO_CFG_DIR>
     <MONO_NUNIT_RUN_TARGET>net_4_x_System_test.dll</MONO_NUNIT_RUN_TARGET>
     <MONO_NUNIT_FIXTURE></MONO_NUNIT_FIXTURE>
-    <MONO_NUNIT_ARGS>-noshadow -exclude=NotWorking,ValueAdd,CAS,InetAccess /labels</MONO_NUNIT_ARGS>
+    <MONO_NUNIT_ARGS>-noshadow -exclude=NotWorking,CAS /labels</MONO_NUNIT_ARGS>
     <MONO_NUNIT_ARGS Condition="'$(MONO_NUNIT_FIXTURE)'!=''">$(MONO_NUNIT_ARGS) -fixture $(MONO_NUNIT_FIXTURE)</MONO_NUNIT_ARGS>
     <MONO_NUNIT_RUN_ADDITIONAL_ARGS>
     </MONO_NUNIT_RUN_ADDITIONAL_ARGS>
@@ -43,4 +43,4 @@
     </BuildMacro>
   </ItemGroup>
   <ItemDefinitionGroup />
-</Project>
\ No newline at end of file
+</Project>