Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Köplinger <alex.koeplinger@outlook.com>2016-03-05 16:38:33 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2016-03-05 17:50:28 +0300
commit14923866689ffdf8346edb50e30e2eb167f27f4d (patch)
tree045b20a701d53f390759cb85c3cfe545e877c1a3 /mcs/class/System.ServiceModel.Web
parent17bd9787566583fc39704d3689842942ddf46dd2 (diff)
[System/ServiceModel] Fix more hardcoded test ports
A test failed on Jenkins today with "address already in use". Opportunistically replaced a few more hardcoded test ports to avoid failures in the future.
Diffstat (limited to 'mcs/class/System.ServiceModel.Web')
-rw-r--r--mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Description/WebScriptEnablingBehaviorTest.cs4
-rw-r--r--mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs7
-rw-r--r--mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Web/WebOperationContextTest.cs9
3 files changed, 14 insertions, 6 deletions
diff --git a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Description/WebScriptEnablingBehaviorTest.cs b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Description/WebScriptEnablingBehaviorTest.cs
index d735c2ebb70..a552f6ea0e0 100644
--- a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Description/WebScriptEnablingBehaviorTest.cs
+++ b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Description/WebScriptEnablingBehaviorTest.cs
@@ -38,6 +38,8 @@ using System.ServiceModel.Web;
using System.Text;
using NUnit.Framework;
+using MonoTests.Helpers;
+
namespace MonoTests.System.ServiceModel.Description
{
public class MyHostFactory : WebScriptServiceHostFactory
@@ -64,7 +66,7 @@ namespace MonoTests.System.ServiceModel.Description
[Test]
public void ScriptGenerator ()
{
- var url = "http://localhost:37564";
+ var url = "http://localhost:" + NetworkHelpers.FindFreePort ();
var host = new MyHostFactory ().CreateServiceHost (typeof (HogeService));
var binding = new WebHttpBinding ();
host.AddServiceEndpoint (typeof (IHogeService), binding, url);
diff --git a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
index bb4593ac99e..d99036dfdbd 100644
--- a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
+++ b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
@@ -39,6 +39,8 @@ using System.Text;
using System.Xml;
using NUnit.Framework;
+using MonoTests.Helpers;
+
namespace MonoTests.System.ServiceModel.Dispatcher
{
[TestFixture]
@@ -257,12 +259,13 @@ namespace MonoTests.System.ServiceModel.Dispatcher
public void WebMessageFormats ()
{
var host = new WebServiceHost (typeof (Hello));
- host.AddServiceEndpoint (typeof (IHello), new WebHttpBinding (), "http://localhost:37564/");
+ var port = NetworkHelpers.FindFreePort ();
+ host.AddServiceEndpoint (typeof (IHello), new WebHttpBinding (), "http://localhost:" + port + "/");
host.Description.Behaviors.Find<ServiceDebugBehavior> ().IncludeExceptionDetailInFaults = true;
host.Open ();
try {
// run client
- using (ChannelFactory<IHello> factory = new ChannelFactory<IHello> (new WebHttpBinding (), "http://localhost:37564/"))
+ using (ChannelFactory<IHello> factory = new ChannelFactory<IHello> (new WebHttpBinding (), "http://localhost:" + port + "/"))
{
factory.Endpoint.Behaviors.Add (new WebHttpBehavior ());
IHello h = factory.CreateChannel ();
diff --git a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Web/WebOperationContextTest.cs b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Web/WebOperationContextTest.cs
index 6ab2d8b4621..f25171f793f 100644
--- a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Web/WebOperationContextTest.cs
+++ b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Web/WebOperationContextTest.cs
@@ -40,6 +40,8 @@ using NUnit.Framework;
using CategoryAttribute = NUnit.Framework.CategoryAttribute;
+using MonoTests.Helpers;
+
namespace MonoTests.System.ServiceModel.Web
{
[TestFixture]
@@ -55,7 +57,7 @@ namespace MonoTests.System.ServiceModel.Web
Assert.IsNull (WebOperationContext.Current, "#1");
#endif
var binding = new WebHttpBinding ();
- var address = new EndpointAddress ("http://localhost:37564");
+ var address = new EndpointAddress ("http://localhost:" + NetworkHelpers.FindFreePort ());
var ch = (IContextChannel) WebChannelFactory<IHogeService>.CreateChannel (binding, address);
using (var ocs = new OperationContextScope (ch)) {
#if !MOBILE
@@ -101,11 +103,12 @@ namespace MonoTests.System.ServiceModel.Web
void CreateResponseTest (Action<IHogeService> a)
{
var host = new WebServiceHost (typeof (HogeService));
- host.AddServiceEndpoint (typeof (IHogeService), new WebHttpBinding (), new Uri ("http://localhost:37564"));
+ var port = NetworkHelpers.FindFreePort ();
+ host.AddServiceEndpoint (typeof (IHogeService), new WebHttpBinding (), new Uri ("http://localhost:" + port));
host.Description.Behaviors.Find<ServiceDebugBehavior> ().IncludeExceptionDetailInFaults = true;
host.Open ();
try {
- using (var cf = new ChannelFactory<IHogeService> (new WebHttpBinding (), new EndpointAddress ("http://localhost:37564"))) {
+ using (var cf = new ChannelFactory<IHogeService> (new WebHttpBinding (), new EndpointAddress ("http://localhost:" + port))) {
cf.Endpoint.Behaviors.Add (new WebHttpBehavior ());
cf.Open ();
var ch = cf.CreateChannel ();