[libanyevent-rabbitmq-perl] 05/151: Added methods for transaction.

Damyan Ivanov dmn at moszumanska.debian.org
Thu Jan 16 11:02:59 UTC 2014


This is an automated email from the git hooks/post-receive script.

dmn pushed a commit to annotated tag debian/1.12-1
in repository libanyevent-rabbitmq-perl.

commit 11a4d16db2b566f822f5dd1597a45e45ea30b445
Author: cooldaemon <cooldaemon at gmail.com>
Date:   Sat Dec 12 17:08:42 2009 +0900

    Added methods for transaction.
---
 lib/RabbitFoot.pm  | 15 +++++++++++++++
 xt/04_use_server.t | 16 +++++++++++++++-
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/lib/RabbitFoot.pm b/lib/RabbitFoot.pm
index 2ffe395..220b653 100644
--- a/lib/RabbitFoot.pm
+++ b/lib/RabbitFoot.pm
@@ -522,6 +522,21 @@ sub recover {
     return;
 }
 
+sub select_tx {
+    my ($self,) = @_;
+    return $self->_post_and_read('Tx::Select', {}, 'Tx::SelectOk', 1,);
+}
+
+sub commit_tx {
+    my ($self,) = @_;
+    return $self->_post_and_read('Tx::Commit', {}, 'Tx::CommitOk', 1,);
+}
+
+sub rollback_tx {
+    my ($self,) = @_;
+    return $self->_post_and_read('Tx::Rollback', {}, 'Tx::RollbackOk', 1,);
+}
+
 sub _post_and_read {
     my ($self, $method, $args, $exp, $id,) = @_;
 
diff --git a/xt/04_use_server.t b/xt/04_use_server.t
index 74cfa1d..32de665 100644
--- a/xt/04_use_server.t
+++ b/xt/04_use_server.t
@@ -21,7 +21,7 @@ eval {
 
 plan skip_all => 'Connection failure: '
                . $conf->{host} . ':' . $conf->{port} if $@;
-plan tests => 19;
+plan tests => 22;
 
 use RabbitFoot;
 
@@ -143,6 +143,20 @@ lives_ok sub {
 }, 'recover';
 
 lives_ok sub {
+    $rf->select_tx();
+}, 'select_tx';
+
+lives_ok sub {
+    publish($rf, 'RabbitMQ is highly reliable systems.');
+    $rf->rollback_tx();
+}, 'rollback_tx';
+
+lives_ok sub {
+    publish($rf, 'RabbitMQ is highly reliable systems.');
+    $rf->commit_tx();
+}, 'commit_tx';
+
+lives_ok sub {
     $rf->purge_queue({queue => 'test_q'});
 }, 'purge_queue';
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libanyevent-rabbitmq-perl.git



More information about the Pkg-perl-cvs-commits mailing list