summaryrefslogtreecommitdiff
path: root/qpid/cpp/bindings
diff options
context:
space:
mode:
authorDarryl L. Pierce <mcpierce@apache.org>2014-08-20 17:46:29 +0000
committerDarryl L. Pierce <mcpierce@apache.org>2014-08-20 17:46:29 +0000
commit9e8aad696474f8ef35fcc52fa14537f613f62f0c (patch)
treecada7fb79103b937903b05ace64394404b2a8f75 /qpid/cpp/bindings
parent8042ecb78d48167cfc3084d2a53569231a6d28cc (diff)
downloadqpid-python-9e8aad696474f8ef35fcc52fa14537f613f62f0c.tar.gz
QPID-5893: Perl unit tests now find the utils module.
The module's not on the @INC path, and really shouldn't be since it's only used by the tests. So now the tests programmatically update @INC to include their directory as a part of the path, and find utils.pm. Fixed the failing Message.t file as well, which includes tests for methods that are deprecated. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1619181 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/bindings')
-rw-r--r--qpid/cpp/bindings/qpid/perl/t/Address.t5
-rw-r--r--qpid/cpp/bindings/qpid/perl/t/Duration.t5
-rw-r--r--qpid/cpp/bindings/qpid/perl/t/Message.t39
3 files changed, 19 insertions, 30 deletions
diff --git a/qpid/cpp/bindings/qpid/perl/t/Address.t b/qpid/cpp/bindings/qpid/perl/t/Address.t
index 4e74f8cad2..409a63d4fe 100644
--- a/qpid/cpp/bindings/qpid/perl/t/Address.t
+++ b/qpid/cpp/bindings/qpid/perl/t/Address.t
@@ -21,7 +21,10 @@
use Test::More qw(no_plan);
use Test::Exception;
-require 'utils.pm';
+# append the location of the test to the PERL5LIB path
+use File::Basename;
+BEGIN {push @INC, dirname (__FILE__)};
+use utils;
# verify that qpid is available
BEGIN { use_ok( 'qpid' ); }
diff --git a/qpid/cpp/bindings/qpid/perl/t/Duration.t b/qpid/cpp/bindings/qpid/perl/t/Duration.t
index 6975e8006f..4f2ae1c606 100644
--- a/qpid/cpp/bindings/qpid/perl/t/Duration.t
+++ b/qpid/cpp/bindings/qpid/perl/t/Duration.t
@@ -21,7 +21,10 @@
use Test::More qw(no_plan);
use Test::Exception;
-require 'utils.pm';
+# append the location of the test to the PERL5LIB path
+use File::Basename;
+BEGIN {push @INC, dirname (__FILE__)};
+use utils;
# verify that qpid is available
BEGIN { use_ok( 'qpid' ); }
diff --git a/qpid/cpp/bindings/qpid/perl/t/Message.t b/qpid/cpp/bindings/qpid/perl/t/Message.t
index c656a7cf90..a17c1121c8 100644
--- a/qpid/cpp/bindings/qpid/perl/t/Message.t
+++ b/qpid/cpp/bindings/qpid/perl/t/Message.t
@@ -21,7 +21,10 @@
use Test::More qw(no_plan);
use Test::Exception;
-require 'utils.pm';
+# append the location of the test to the PERL5LIB path
+use File::Basename;
+BEGIN {push @INC, dirname (__FILE__)};
+use utils;
# verify that qpid is available
BEGIN { use_ok( 'qpid' ); }
@@ -241,53 +244,33 @@ dies_ok (sub {$message->set_content(undef);},
"Content cannot be null");
# can be an empty string
-$message->set_content("");
-ok ($message->get_content() eq "",
+$message->set_content_object("");
+ok ($message->get_content_object() eq "",
"Content can be an empty string");
# can be an arbitrary string
my $content = random_string(255);
-$message->set_content($content);
-ok ($message->get_content() eq $content,
+$message->set_content_object($content);
+ok ($message->get_content_object() eq $content,
"Content can be an arbitrary string");
# Embedded nulls should be handled properly
$content = { id => 1234, name => "With\x00null" };
qpid::messaging::encode($content, $message);
-my $map = qpid::messaging::decode_map($message);
+my $map = qpid::messaging::decode($message);
ok ($map->{name} eq "With\x00null",
"Nulls embedded in map values work.");
# Unicode strings shouldn't be broken
$content = { id => 1234, name => "Euro=\x{20AC}" };
qpid::messaging::encode($content, $message);
-$map = qpid::messaging::decode_map($message);
+$map = qpid::messaging::decode($message);
ok ($map->{name} eq "Euro=\x{20AC}",
"Unicode strings encoded correctly.");
# Maps inside maps should work
$content = { id => 1234, name => { first => "tom" } };
qpid::messaging::encode($content, $message);
-$map = qpid::messaging::decode_map($message);
+$map = qpid::messaging::decode($message);
ok ($map->{name}{first} eq "tom",
"Map inside map encoded correctly.");
-
-# Setting the content as a hash automatically encodes it
-($content) = {"id" => "1234", "name" => "qpid"};
-$message->set_content($content);
-ok ($message->get_content_type() eq "amqp/map",
- "Hashes are automatically encoded correctly");
-
-# Setting the content as a list automatically encodes it
-my @acontent = (1, 2, 3, 4);
-$message->set_content(\@acontent);
-ok ($message->get_content_type() eq "amqp/list",
- "Lists are automatically encoded correctly");
-
-# content size
-# content size is correct
-my $content_size = int(rand(256));
-$content = random_string($content_size);
-$message->set_content($content);
-ok ($message->get_content_size() == $content_size,
- "Content size is correct");