You've already forked linux-packaging-mono
Imported Upstream version 4.2.0.179
Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
committed by
Jo Shields
parent
183bba2c9a
commit
6992685b86
@ -43,6 +43,8 @@ using System.Threading;
|
||||
using System.Xml;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.ServiceModel.Channels
|
||||
{
|
||||
[TestFixture]
|
||||
@ -131,7 +133,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
CustomBinding binding = new CustomBinding (sbe,
|
||||
new HttpTransportBindingElement ());
|
||||
IChannelListener<IReplyChannel> l =
|
||||
binding.BuildChannelListener<IReplyChannel> (new Uri ("http://localhost:37564"), new BindingParameterCollection ());
|
||||
binding.BuildChannelListener<IReplyChannel> (new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ()), new BindingParameterCollection ());
|
||||
try {
|
||||
l.Open ();
|
||||
} finally {
|
||||
@ -171,11 +173,11 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
b_res.ReceiveTimeout = b_res.SendTimeout = TimeSpan.FromSeconds (10);
|
||||
|
||||
EndpointAddress remaddr = new EndpointAddress (
|
||||
new Uri ("http://localhost:37564"),
|
||||
new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ()),
|
||||
new X509CertificateEndpointIdentity (cert2));
|
||||
CalcProxy proxy = null;
|
||||
ServiceHost host = new ServiceHost (typeof (CalcService));
|
||||
host.AddServiceEndpoint (typeof (ICalc), b_res, "http://localhost:37564");
|
||||
host.AddServiceEndpoint (typeof (ICalc), b_res, "http://localhost:" + NetworkHelpers.FindFreePort ());
|
||||
|
||||
ServiceCredentials cred = new ServiceCredentials ();
|
||||
cred.ServiceCertificate.Certificate = cert;
|
||||
@ -240,7 +242,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
new HttpTransportBindingElement ();
|
||||
CustomBinding binding = new CustomBinding (sbe, hbe);
|
||||
host.AddServiceEndpoint (typeof (IFoo),
|
||||
binding, new Uri ("http://localhost:37564"));
|
||||
binding, new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ()));
|
||||
ServiceCredentials cred = new ServiceCredentials ();
|
||||
cred.ServiceCertificate.Certificate =
|
||||
new X509Certificate2 ("Test/Resources/test.pfx", "mono");
|
||||
|
@ -36,6 +36,8 @@ using System.Text;
|
||||
using System.Xml;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
using Element = System.ServiceModel.Channels.BinaryMessageEncodingBindingElement;
|
||||
|
||||
namespace MonoTests.System.ServiceModel.Channels
|
||||
@ -191,14 +193,15 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
var bindingsvc = new CustomBinding (new BindingElement [] {
|
||||
new BinaryMessageEncodingBindingElement (),
|
||||
new TcpTransportBindingElement () });
|
||||
host.AddServiceEndpoint (typeof (IFoo), bindingsvc, "net.tcp://localhost:37564/");
|
||||
int port = NetworkHelpers.FindFreePort ();
|
||||
host.AddServiceEndpoint (typeof (IFoo), bindingsvc, "net.tcp://localhost:" + port + "/");
|
||||
host.Description.Behaviors.Find<ServiceBehaviorAttribute> ().IncludeExceptionDetailInFaults = true;
|
||||
host.Open (TimeSpan.FromSeconds (5));
|
||||
try {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
var bindingcli = new NetTcpBinding ();
|
||||
bindingcli.Security.Mode = SecurityMode.None;
|
||||
var cli = new ChannelFactory<IFooClient> (bindingcli, new EndpointAddress ("net.tcp://localhost:37564/")).CreateChannel ();
|
||||
var cli = new ChannelFactory<IFooClient> (bindingcli, new EndpointAddress ("net.tcp://localhost:" + port + "/")).CreateChannel ();
|
||||
Assert.AreEqual ("test for echo", cli.Echo ("TEST FOR ECHO"), "#1");
|
||||
var sid = cli.SessionId;
|
||||
Assert.AreEqual (3000, cli.Add (1000, 2000), "#2");
|
||||
@ -207,7 +210,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
}
|
||||
} finally {
|
||||
host.Close (TimeSpan.FromSeconds (5));
|
||||
var t = new TcpListener (37564);
|
||||
var t = new TcpListener (port);
|
||||
t.Start ();
|
||||
t.Stop ();
|
||||
}
|
||||
@ -220,7 +223,8 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
var bindingsvc = new CustomBinding (new BindingElement [] {
|
||||
new BinaryMessageEncodingBindingElement (),
|
||||
new HttpTransportBindingElement () });
|
||||
host.AddServiceEndpoint (typeof (IFoo), bindingsvc, "http://localhost:37564/");
|
||||
int port = NetworkHelpers.FindFreePort ();
|
||||
host.AddServiceEndpoint (typeof (IFoo), bindingsvc, "http://localhost:" + port + "/");
|
||||
host.Description.Behaviors.Find<ServiceBehaviorAttribute> ().IncludeExceptionDetailInFaults = true;
|
||||
host.Open (TimeSpan.FromSeconds (5));
|
||||
try {
|
||||
@ -228,7 +232,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
var bindingcli = new CustomBinding (new BindingElement [] {
|
||||
new BinaryMessageEncodingBindingElement (),
|
||||
new HttpTransportBindingElement () });
|
||||
var cli = new ChannelFactory<IFooClient> (bindingcli, new EndpointAddress ("http://localhost:37564/")).CreateChannel ();
|
||||
var cli = new ChannelFactory<IFooClient> (bindingcli, new EndpointAddress ("http://localhost:" + port + "/")).CreateChannel ();
|
||||
Assert.AreEqual ("test for echo", cli.Echo ("TEST FOR ECHO"), "#1");
|
||||
var sid = cli.SessionId;
|
||||
Assert.AreEqual (3000, cli.Add (1000, 2000), "#2");
|
||||
@ -237,7 +241,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
}
|
||||
} finally {
|
||||
host.Close (TimeSpan.FromSeconds (5));
|
||||
var t = new TcpListener (37564);
|
||||
var t = new TcpListener (port);
|
||||
t.Start ();
|
||||
t.Stop ();
|
||||
}
|
||||
|
@ -40,6 +40,8 @@ using System.Text;
|
||||
using System.Xml;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.ServiceModel.Channels
|
||||
{
|
||||
[TestFixture]
|
||||
@ -211,7 +213,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
new HandlerTransportBindingElement (sender));
|
||||
|
||||
EndpointAddress address = new EndpointAddress (
|
||||
new Uri ("http://localhost:37564"),
|
||||
new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ()),
|
||||
new X509CertificateEndpointIdentity (new X509Certificate2 ("Test/Resources/test.pfx", "mono")));
|
||||
|
||||
ChannelFactory<IRequestChannel> cf =
|
||||
@ -259,7 +261,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
new HandlerTransportBindingElement (sender));
|
||||
|
||||
EndpointAddress address = new EndpointAddress (
|
||||
new Uri ("http://localhost:37564"),
|
||||
new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ()),
|
||||
new X509CertificateEndpointIdentity (new X509Certificate2 ("Test/Resources/test.pfx", "mono")));
|
||||
|
||||
ChannelProtectionRequirements reqs =
|
||||
@ -322,7 +324,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
new HttpTransportBindingElement ());
|
||||
BindingContext ctx = new BindingContext (
|
||||
cb, new BindingParameterCollection (),
|
||||
new Uri ("http://localhost:37564"), String.Empty, ListenUriMode.Unique);
|
||||
new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ()), String.Empty, ListenUriMode.Unique);
|
||||
new TextMessageEncodingBindingElement ().BuildChannelListener<IReplyChannel> (ctx);
|
||||
}
|
||||
|
||||
@ -336,7 +338,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
ServiceHost host = new ServiceHost (typeof (FooService));
|
||||
host.AddServiceEndpoint (typeof (IFooService),
|
||||
new CustomBinding (new MyBindingElement (false), new HttpTransportBindingElement ()),
|
||||
"http://localhost:37564");
|
||||
"http://localhost:" + NetworkHelpers.FindFreePort ());
|
||||
host.Open ();
|
||||
}
|
||||
|
||||
@ -349,7 +351,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
ServiceHost host = new ServiceHost (typeof (FooService));
|
||||
host.AddServiceEndpoint (typeof (IFooService),
|
||||
new CustomBinding (new MyBindingElement (true), new HttpTransportBindingElement ()),
|
||||
"http://localhost:37564");
|
||||
"http://localhost:" + NetworkHelpers.FindFreePort ());
|
||||
host.Open ();
|
||||
host.Close ();
|
||||
}
|
||||
@ -363,7 +365,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
ServiceHost host = new ServiceHost (typeof (FooService));
|
||||
host.AddServiceEndpoint (typeof (IFooService),
|
||||
new CustomBinding (new MyBindingElement (true), new HttpTransportBindingElement ()),
|
||||
"http://localhost:37564", new Uri ("foobar", UriKind.Relative));
|
||||
"http://localhost:" + NetworkHelpers.FindFreePort (), new Uri ("foobar", UriKind.Relative));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -372,10 +374,10 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
{
|
||||
// MyBindingElement overrides GetProperty<T>() to call GetInnerProperty<T>() (default implementation).
|
||||
// HttpTransportBindingElement should return Soap11.
|
||||
ServiceHost host = new ServiceHost (typeof (FooService), new Uri ("http://localhost:37564"));
|
||||
ServiceHost host = new ServiceHost (typeof (FooService), new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ()));
|
||||
host.AddServiceEndpoint (typeof (IFooService),
|
||||
new CustomBinding (new MyBindingElement (true), new HttpTransportBindingElement ()),
|
||||
"http://localhost:37564", new Uri ("foobar", UriKind.Relative));
|
||||
"http://localhost:" + NetworkHelpers.FindFreePort (), new Uri ("foobar", UriKind.Relative));
|
||||
host.Open ();
|
||||
host.Close ();
|
||||
}
|
||||
|
@ -38,6 +38,8 @@ using System.Threading;
|
||||
using System.Xml;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
#if NET_4_0
|
||||
using System.Security.Authentication.ExtendedProtection;
|
||||
#endif
|
||||
@ -203,7 +205,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
var cf = new HttpTransportBindingElement ().BuildChannelFactory<IRequestChannel> (ctx);
|
||||
Assert.IsTrue (cf is ChannelFactoryBase<IRequestChannel>, "#1");
|
||||
cf.Open ();
|
||||
cf.CreateChannel (new EndpointAddress ("http://localhost:8080"), null);
|
||||
cf.CreateChannel (new EndpointAddress ("http://localhost:" + NetworkHelpers.FindFreePort ()), null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -228,7 +230,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
public void EndpointAddressAndViaMustMatchOnAddressingNone ()
|
||||
{
|
||||
try {
|
||||
var ch = ChannelFactory<IFoo>.CreateChannel (new BasicHttpBinding (), new EndpointAddress ("http://localhost:37564/"), new Uri ("http://localhost:8080/HogeService"));
|
||||
var ch = ChannelFactory<IFoo>.CreateChannel (new BasicHttpBinding (), new EndpointAddress ("http://localhost:" + NetworkHelpers.FindFreePort () + "/"), new Uri ("http://localhost:" + NetworkHelpers.FindFreePort () + "/HogeService"));
|
||||
((ICommunicationObject) ch).Close ();
|
||||
} catch (TargetInvocationException) {
|
||||
// we throw this exception so far. Since it is
|
||||
@ -338,7 +340,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
BindingContext lbc = new BindingContext (
|
||||
new CustomBinding (),
|
||||
new BindingParameterCollection (),
|
||||
new Uri ("http://localhost:37564"),
|
||||
new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ()),
|
||||
String.Empty, ListenUriMode.Explicit);
|
||||
listener = lel.BuildChannelListener<IReplyChannel> (lbc);
|
||||
|
||||
@ -370,7 +372,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
factory.Open ();
|
||||
|
||||
IRequestChannel request = factory.CreateChannel (
|
||||
new EndpointAddress ("http://localhost:37564"));
|
||||
new EndpointAddress ("http://localhost:" + NetworkHelpers.FindFreePort ()));
|
||||
|
||||
request.Open ();
|
||||
|
||||
|
@ -41,6 +41,8 @@ using System.ServiceModel.Security.Tokens;
|
||||
using System.Xml;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.ServiceModel.Channels
|
||||
{
|
||||
[TestFixture]
|
||||
@ -428,7 +430,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
ClientCredentials cred = new ClientCredentials ();
|
||||
cred.ClientCertificate.Certificate =
|
||||
new X509Certificate2 ("Test/Resources/test.pfx", "mono");
|
||||
IChannelFactory<IReplyChannel> ch = b.BuildChannelFactory<IReplyChannel> (new Uri ("http://localhost:37564"), cred);
|
||||
IChannelFactory<IReplyChannel> ch = b.BuildChannelFactory<IReplyChannel> (new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ()), cred);
|
||||
try {
|
||||
ch.Open ();
|
||||
} finally {
|
||||
@ -456,7 +458,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
ServiceCredentials cred = new ServiceCredentials ();
|
||||
cred.ServiceCertificate.Certificate =
|
||||
new X509Certificate2 ("Test/Resources/test.pfx", "mono");
|
||||
IChannelListener<IReplyChannel> ch = b.BuildChannelListener<IReplyChannel> (new Uri ("http://localhost:37564"), cred);
|
||||
IChannelListener<IReplyChannel> ch = b.BuildChannelListener<IReplyChannel> (new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ()), cred);
|
||||
try {
|
||||
ch.Open ();
|
||||
} finally {
|
||||
@ -478,7 +480,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
new UserNameSecurityTokenParameters ());
|
||||
Binding b = new CustomBinding (be, new HttpTransportBindingElement ());
|
||||
X509Certificate2 cert = new X509Certificate2 ("Test/Resources/test.pfx", "mono");
|
||||
EndpointAddress ea = new EndpointAddress (new Uri ("http://localhost:37564"), new X509CertificateEndpointIdentity (cert));
|
||||
EndpointAddress ea = new EndpointAddress (new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ()), new X509CertificateEndpointIdentity (cert));
|
||||
CalcProxy client = new CalcProxy (b, ea);
|
||||
client.ClientCredentials.UserName.UserName = "rupert";
|
||||
client.Sum (1, 2);
|
||||
|
@ -37,6 +37,8 @@ using System.Threading;
|
||||
using System.Xml;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.ServiceModel.Channels
|
||||
{
|
||||
[TestFixture]
|
||||
@ -173,8 +175,9 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
new TcpTransportBindingElement () });
|
||||
bindingS.ReceiveTimeout = TimeSpan.FromSeconds (5);
|
||||
bindingS.OpenTimeout = TimeSpan.FromSeconds (20);
|
||||
int port = NetworkHelpers.FindFreePort ();
|
||||
host.AddServiceEndpoint (typeof (IFoo),
|
||||
bindingS, new Uri ("net.tcp://localhost:37564"));
|
||||
bindingS, new Uri ("net.tcp://localhost:" + port));
|
||||
host.Description.Behaviors.Find<ServiceBehaviorAttribute> ().IncludeExceptionDetailInFaults = true;
|
||||
host.Open ();
|
||||
|
||||
@ -182,7 +185,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
for (int i = 0; i < 2; i++) {
|
||||
var bindingC = new NetTcpBinding ();
|
||||
bindingC.Security.Mode = SecurityMode.None;
|
||||
IFooChannel proxy = new ChannelFactory<IFooChannel> (bindingC, new EndpointAddress ("net.tcp://localhost:37564/")).CreateChannel ();
|
||||
IFooChannel proxy = new ChannelFactory<IFooChannel> (bindingC, new EndpointAddress ("net.tcp://localhost:" + port + "/")).CreateChannel ();
|
||||
proxy.Open ();
|
||||
try {
|
||||
Assert.AreEqual ("TEST FOR ECHO", proxy.Echo ("TEST FOR ECHO"), "#1");
|
||||
@ -212,8 +215,9 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
bindingS.Security.Mode = SecurityMode.None;
|
||||
bindingS.ReceiveTimeout = TimeSpan.FromSeconds (5);
|
||||
bindingS.OpenTimeout = TimeSpan.FromSeconds (20);
|
||||
int port = NetworkHelpers.FindFreePort ();
|
||||
host.AddServiceEndpoint (typeof (IFoo),
|
||||
bindingS, new Uri ("net.tcp://localhost:37564"));
|
||||
bindingS, new Uri ("net.tcp://localhost:" + port));
|
||||
host.Description.Behaviors.Find<ServiceBehaviorAttribute> ().IncludeExceptionDetailInFaults = true;
|
||||
host.Open ();
|
||||
|
||||
@ -222,7 +226,7 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
var bindingC = new NetTcpBinding ();
|
||||
bindingS.TransferMode = TransferMode.Streamed;
|
||||
bindingC.Security.Mode = SecurityMode.None;
|
||||
IFooChannel proxy = new ChannelFactory<IFooChannel> (bindingC, new EndpointAddress ("net.tcp://localhost:37564/")).CreateChannel ();
|
||||
IFooChannel proxy = new ChannelFactory<IFooChannel> (bindingC, new EndpointAddress ("net.tcp://localhost:" + port + "/")).CreateChannel ();
|
||||
proxy.Open ();
|
||||
try {
|
||||
Assert.AreEqual ("TEST FOR ECHO", proxy.Echo ("TEST FOR ECHO"), "#1");
|
||||
|
Reference in New Issue
Block a user