[libmessage-passing-zeromq-perl] 06/78: All working
Jonas Smedegaard
js at alioth.debian.org
Mon Sep 30 09:28:16 UTC 2013
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository libmessage-passing-zeromq-perl.
commit 3fc8473bbc5ff5b888078d0b3907cbd66d96470d
Author: Tomas Doran <bobtfish at bobtfish.net>
Date: Sat Feb 25 11:33:31 2012 +0000
All working
---
lib/Log/Stash/Output/ZeroMQ.pm | 3 ++-
t/input.t | 7 ++++---
t/output.t | 19 +++++++++++++------
3 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/lib/Log/Stash/Output/ZeroMQ.pm b/lib/Log/Stash/Output/ZeroMQ.pm
index 877e72f..8f15b70 100644
--- a/lib/Log/Stash/Output/ZeroMQ.pm
+++ b/lib/Log/Stash/Output/ZeroMQ.pm
@@ -38,7 +38,8 @@ has _socket => (
sub consume {
my $self = shift;
my $data = shift;
- $self->_zmq_send($self->encode($data));
+ my $bytes = $self->encode($data);
+ $self->_zmq_send($bytes);
}
with 'Log::Stash::Mixin::Output';
diff --git a/t/input.t b/t/input.t
index 90b1981..07f0ac7 100644
--- a/t/input.t
+++ b/t/input.t
@@ -7,7 +7,10 @@ use Log::Stash::Input::ZeroMQ;
use Log::Stash::Output::Test;
use ZeroMQ qw/:all/;
-my $output = Log::Stash::Output::Test->new();
+my $cv = AnyEvent->condvar;
+my $output = Log::Stash::Output::Test->new(
+ on_consume_cb => sub { $cv->send },
+);
my $input = Log::Stash::Input::ZeroMQ->new(
output_to => $output,
);
@@ -19,8 +22,6 @@ $socket->connect('tcp://127.0.0.1:5558');
$socket->send('{"message":"foo"}');
-my $cv = AnyEvent->condvar;
-my $t = AnyEvent->timer(after => 2, cb => sub { $cv->send });
$cv->recv;
is $output->messages_count, 1;
diff --git a/t/output.t b/t/output.t
index 9d73c39..a7f6d9a 100644
--- a/t/output.t
+++ b/t/output.t
@@ -7,15 +7,22 @@ use Log::Stash::Input::ZeroMQ;
use Log::Stash::Output::Test;
use Log::Stash::Output::ZeroMQ;
-use ZeroMQ qw/:all/;
-
-my $ctx = ZeroMQ::Context->new();
-my $socket = $ctx->socket(ZMQ_SUB);
-$socket->bind('tcp://127.0.0.1:5558');
-
my $output = Log::Stash::Output::ZeroMQ->new();
$output->consume({foo => 'bar'});
+use Log::Stash::Input::ZeroMQ;
+use Log::Stash::Output::Test;
+my $cv = AnyEvent->condvar;
+my $input = Log::Stash::Input::ZeroMQ->new(
+ output_to => Log::Stash::Output::Test->new(
+ on_consume_cb => sub { $cv->send }
+ ),
+);
+$cv->recv;
+
+is $input->output_to->messages_count, 1;
+is_deeply([$input->output_to->messages], [{foo => 'bar'}]);
+
done_testing;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmessage-passing-zeromq-perl.git
More information about the Pkg-perl-cvs-commits
mailing list