Browse files

Use Sender/Receiver for socket pair tests.

  • Loading branch information...
1 parent 00cedad commit efa642e5bd00d442f86149e6a21121c63e350d5c @jgoz jgoz committed Nov 10, 2012
View
56 src/ZeroMQ.AcceptanceTests/ZmqSocketSpecs/Bind_Connect.cs
@@ -11,8 +11,8 @@ public class WhenConnectingViaTcpToAnIpAndPortBoundAddress : UsingReqRep
{
private void Execute()
{
- server.Bind("tcp://127.0.0.1:9000");
- client.Connect("tcp://127.0.0.1:9000");
+ Receiver.Bind("tcp://127.0.0.1:9000");
+ Sender.Connect("tcp://127.0.0.1:9000");
}
[Test]
@@ -26,8 +26,8 @@ public class WhenConnectingViaTcpToAWildcardPortBoundAddress : UsingReqRep
{
private void Execute()
{
- server.Bind("tcp://*:9000");
- client.Connect("tcp://127.0.0.1:9000");
+ Receiver.Bind("tcp://*:9000");
+ Sender.Connect("tcp://127.0.0.1:9000");
}
[Test]
@@ -41,8 +41,8 @@ public class WhenConnectingViaInprocToANamedAddress : UsingReqRep
{
private void Execute()
{
- server.Bind("inproc://named");
- client.Connect("inproc://named");
+ Receiver.Bind("inproc://named");
+ Sender.Connect("inproc://named");
}
[Test]
@@ -56,14 +56,14 @@ public class WhenConnectingViaPgmWithPubSubSockets : UsingPubSub
{
private void Execute()
{
- server.Linger = TimeSpan.Zero;
- server.Connect("epgm://127.0.0.1;239.192.1.1:5000");
+ Sender.Linger = TimeSpan.Zero;
+ Sender.Connect("epgm://127.0.0.1;239.192.1.1:5000");
- client.Linger = TimeSpan.Zero;
- client.SubscribeAll();
- client.Connect("epgm://127.0.0.1;239.192.1.1:5000");
+ Receiver.Linger = TimeSpan.Zero;
+ Receiver.SubscribeAll();
+ Receiver.Connect("epgm://127.0.0.1;239.192.1.1:5000");
- server.SendFrame(Messages.SingleMessage);
+ Sender.SendFrame(Messages.SingleMessage);
// TODO: Is there any other way to ensure the PGM thread has started?
Thread.Sleep(1000);
@@ -80,7 +80,7 @@ public class WhenConnectingViaPgmWithIncompatibleSockets : UsingReqRep
{
private void Execute()
{
- server.Connect("epgm://127.0.0.1;239.192.1.1:5000");
+ Sender.Connect("epgm://127.0.0.1;239.192.1.1:5000");
}
[Test]
@@ -99,8 +99,8 @@ public class WhenConnectingViaIpcToAFileMappedAddress : UsingReqRep
{
private void Execute()
{
- server.Bind("ipc:///tmp/testsock");
- client.Connect("ipc:///tmp/testsock");
+ Receiver.Bind("ipc:///tmp/testsock");
+ Sender.Connect("ipc:///tmp/testsock");
}
#if POSIX
@@ -129,8 +129,8 @@ private void Execute()
{
if (ZmqVersion.Current.IsAtLeast(3))
{
- server.Bind("tcp://127.0.0.1:9000");
- server.Unbind("tcp://127.0.0.1:9000");
+ Receiver.Bind("tcp://127.0.0.1:9000");
+ Receiver.Unbind("tcp://127.0.0.1:9000");
}
}
@@ -147,8 +147,8 @@ private void Execute()
{
if (ZmqVersion.Current.IsAtLeast(3))
{
- server.Bind("tcp://127.0.0.1:9000");
- server.Unbind("tcp://127.0.0.1:9001");
+ Receiver.Bind("tcp://127.0.0.1:9000");
+ Receiver.Unbind("tcp://127.0.0.1:9001");
}
}
@@ -165,9 +165,9 @@ private void Execute()
{
if (ZmqVersion.Current.IsAtLeast(3))
{
- server.Bind("tcp://127.0.0.1:9000");
- client.Connect("tcp://127.0.0.1:9000");
- server.Unbind("tcp://127.0.0.1:9000");
+ Receiver.Bind("tcp://127.0.0.1:9000");
+ Sender.Connect("tcp://127.0.0.1:9000");
+ Receiver.Unbind("tcp://127.0.0.1:9000");
}
}
@@ -184,9 +184,9 @@ private void Execute()
{
if (ZmqVersion.Current.IsAtLeast(3))
{
- server.Bind("tcp://127.0.0.1:9000");
- client.Connect("tcp://127.0.0.1:9000");
- client.Disconnect("tcp://127.0.0.1:9000");
+ Receiver.Bind("tcp://127.0.0.1:9000");
+ Sender.Connect("tcp://127.0.0.1:9000");
+ Sender.Disconnect("tcp://127.0.0.1:9000");
}
}
@@ -203,9 +203,9 @@ private void Execute()
{
if (ZmqVersion.Current.IsAtLeast(3))
{
- server.Bind("tcp://127.0.0.1:9000");
- client.Connect("tcp://127.0.0.1:9000");
- client.Disconnect("tcp://127.0.0.1:9001");
+ Receiver.Bind("tcp://127.0.0.1:9000");
+ Sender.Connect("tcp://127.0.0.1:9000");
+ Sender.Disconnect("tcp://127.0.0.1:9001");
}
}
View
32 src/ZeroMQ.AcceptanceTests/ZmqSocketSpecs/SpecContext.cs
@@ -7,35 +7,33 @@
public class UsingSocketPair
{
- private readonly SocketType clientType;
- private readonly SocketType serverType;
+ private readonly SocketType _senderType;
+ private readonly SocketType _receiverType;
- protected ZmqSocket client;
- protected ZmqSocket server;
- protected ZmqContext zmqContext;
- protected Exception exception;
+ protected ZmqSocket Sender;
+ protected ZmqSocket Receiver;
+ protected ZmqContext ZmqContext;
- public UsingSocketPair(SocketType clientType, SocketType serverType)
+ public UsingSocketPair(SocketType senderType, SocketType receiverType)
{
- this.clientType = clientType;
- this.serverType = serverType;
+ _receiverType = receiverType;
+ _senderType = senderType;
}
[TestFixtureSetUp]
public void Initialize()
{
- zmqContext = ZmqContext.Create();
- client = zmqContext.CreateSocket(this.clientType);
- server = zmqContext.CreateSocket(this.serverType);
+ ZmqContext = ZmqContext.Create();
+ Sender = ZmqContext.CreateSocket(_senderType);
+ Receiver = ZmqContext.CreateSocket(_receiverType);
}
[TestFixtureTearDown]
public void Cleanup()
{
- exception = null;
- client.Dispose();
- server.Dispose();
- zmqContext.Dispose();
+ Sender.Dispose();
+ Receiver.Dispose();
+ ZmqContext.Dispose();
}
}
@@ -46,7 +44,7 @@ public class UsingReqRep : UsingSocketPair
public class UsingPubSub : UsingSocketPair
{
- public UsingPubSub() : base(SocketType.SUB, SocketType.PUB) { }
+ public UsingPubSub() : base(SocketType.PUB, SocketType.SUB) { }
}

0 comments on commit efa642e

Please sign in to comment.