commit b835695153660766dce6e601edd750fbc173d2fe
Author: Darryl L. Pierce <dpierce(a)redhat.com>
Date: Fri Feb 1 09:50:34 2013 -0500
First official release for Fedora.
.gitignore | 1 +
...Fixes-to-Perl-code-due-to-unit-test-failu.patch | 294 ++++++++++++++++++
02-PROTON-176-Provide-Perl-unit-tests.patch | 317 ++++++++++++++++++++
...Add-unit-tests-for-qpid-proton-Messenger-.patch | 180 +++++++++++
04-NO-JIRA-Fixed-the-package-name-for-Perl.patch | 28 ++
...oved-Version.pm-and-CMakeLists.txt-from-t.patch | 26 ++
perl-qpid_proton.spec | 82 +++++
sources | 1 +
8 files changed, 929 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..6d6f2b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/perl-qpid_proton-0.3.tar.gz
diff --git a/01-PROTON-176-Fixes-to-Perl-code-due-to-unit-test-failu.patch
b/01-PROTON-176-Fixes-to-Perl-code-due-to-unit-test-failu.patch
new file mode 100644
index 0000000..d552e96
--- /dev/null
+++ b/01-PROTON-176-Fixes-to-Perl-code-due-to-unit-test-failu.patch
@@ -0,0 +1,294 @@
+From d5b922b22e477ffff86204126b75ea4993ad58a3 Mon Sep 17 00:00:00 2001
+From: mcpierce <mcpierce@13f79535-47bb-0310-9956-ffa450edef68>
+Date: Wed, 16 Jan 2013 21:48:14 +0000
+Subject: [PATCH 2/7] PROTON-176: Fixes to Perl code due to unit test failures.
+
+Fixes for code that failed the new unit tests.
+
+git-svn-id:
https://svn.apache.org/repos/asf/qpid/proton/trunk@1434420
13f79535-47bb-0310-9956-ffa450edef68
+---
+ proton-c/bindings/perl/lib/qpid/proton/Message.pm | 76 +++++++++++++----
+ proton-c/bindings/perl/perl.i | 99 +++++++++++++++++++++++
+ 2 files changed, 160 insertions(+), 15 deletions(-)
+
+diff --git a/proton-c/bindings/perl/lib/qpid/proton/Message.pm
b/proton-c/bindings/perl/lib/qpid/proton/Message.pm
+index 616505d..6023941 100644
+--- a/proton-c/bindings/perl/lib/qpid/proton/Message.pm
++++ b/proton-c/bindings/perl/lib/qpid/proton/Message.pm
+@@ -19,6 +19,11 @@
+
+ package qpid::proton::Message;
+
++our $DATA_FORMAT = $cproton_perl::PN_DATA;
++our $TEXT_FORMAT = $cproton_perl::PN_TEXT;
++our $AMQP_FORMAT = $cproton_perl::PN_AMQP;
++our $JSON_FORMAT = $cproton_perl::PN_JSON;
++
+ sub new {
+ my ($class) = @_;
+ my ($self) = {};
+@@ -32,7 +37,9 @@ sub new {
+
+ sub DESTROY {
+ my ($self) = @_;
+- cproton_perl::pn_message_free($self->{_impl});
++ my $impl = $self->{_impl};
++
++ cproton_perl::pn_message_free($impl);
+ }
+
+ sub get_impl {
+@@ -62,7 +69,7 @@ sub set_durable {
+
+ sub get_durable {
+ my ($self) = @_;
+- return cproton_perl::pn_message_get_durable($self->{_impl});
++ return cproton_perl::pn_message_is_durable($self->{_impl});
+ }
+
+ sub set_priority {
+@@ -92,7 +99,7 @@ sub set_first_acquirer {
+
+ sub get_first_acquirer {
+ my ($self) = @_;
+- return cproton_perl::pn_message_get_first_acquirer($self->{_impl});
++ return cproton_perl::pn_message_is_first_acquirer($self->{_impl});
+ }
+
+ sub set_delivery_count {
+@@ -107,22 +114,34 @@ sub get_delivery_count {
+
+ sub set_id {
+ my ($self) = @_;
+- cproton_perl::pn_message_set_id($self->{_impl}, $_[1]);
++ my $id = $_[1];
++
++ die "Message id must be defined" if !defined($id);
++
++ cproton_perl::pn_message_set_id($self->{_impl}, $id);
+ }
+
+ sub get_id {
+ my ($self) = @_;
+- return cproton_perl::pn_message_get_id($self->{_impl});
++ my $id = cproton_perl::pn_message_get_id($self->{_impl});
++
++ return $id;
+ }
+
+ sub set_user_id {
+ my ($self) = @_;
+- cproton_perl::pn_message_set_user_id($self->{_impl}, $_[1]);
++ my $user_id = $_[1];
++
++ die "User id must be defined" if !defined($user_id);
++
++ cproton_perl::pn_message_set_user_id($self->{_impl}, $user_id);
+ }
+
+ sub get_user_id {
+ my ($self) = @_;
+- return cproton_perl::pn_message_get_user_id($self->{_impl}, $_[1]);
++ my $user_id = cproton_perl::pn_message_get_user_id($self->{_impl});
++
++ return $user_id;
+ }
+
+ sub set_address {
+@@ -167,7 +186,11 @@ sub get_correlation_id {
+
+ sub set_format {
+ my ($self) = @_;
+- cproton_perl::pn_message_set_format($self->{_impl}, $_[1]);
++ my $format = $_[1];
++
++ die "Format must be defined" if !defined($format);
++
++ cproton_perl::pn_message_set_format($self->{_impl}, $format);
+ }
+
+ sub get_format {
+@@ -187,12 +210,15 @@ sub get_content_type {
+
+ sub set_content {
+ my ($self) = @_;
+- my ($content) = $_[1];
++ my $content = $_[1];
++
+ cproton_perl::pn_message_load($self->{_impl}, $content);
+ }
+
+ sub get_content {
+ my ($self) = @_;
++ my $content = cproton_perl::pn_message_save($self->{_impl}, 1024);
++
+ return cproton_perl::pn_message_save($self->{_impl}, 1024);
+ }
+
+@@ -206,19 +232,35 @@ sub get_content_encoding {
+ return cproton_perl::pn_message_get_content_encoding($self->{_impl});
+ }
+
+-sub set_expires {
++sub set_expiry_time {
+ my ($self) = @_;
+- cproton_perl::pn_message_set_expires($self->{_impl}, $_[1]);
++ my $expiry_time = $_[1];
++
++ die "Expiry time must be defined" if !defined($expiry_time);
++
++ $expiry_time = int($expiry_time);
++
++ die "Expiry time must be non-negative" if $expiry_time < 0;
++
++ cproton_perl::pn_message_set_expiry_time($self->{_impl}, $expiry_time);
+ }
+
+-sub get_expires {
++sub get_expiry_time {
+ my ($self) = @_;
+- return cproton_perl::pn_message_get_expires($self->{_impl});
++ return cproton_perl::pn_message_get_expiry_time($self->{_impl});
+ }
+
+ sub set_creation_time {
+ my ($self) = @_;
+- cproton_perl::pn_message_set_creation_time($self->{_impl}, $_[1]);
++ my $creation_time = $_[1];
++
++ die "Creation time must be defined" if !defined($creation_time);
++
++ $creation_time = int($creation_time);
++
++ die "Creation time must be non-negative" if $creation_time < 0;
++
++ cproton_perl::pn_message_set_creation_time($self->{_impl}, $creation_time);
+ }
+
+ sub get_creation_time {
+@@ -238,7 +280,11 @@ sub get_group_id {
+
+ sub set_group_sequence {
+ my ($self) = @_;
+- cproton_perl::pn_message_set_group_sequence($self->{_impl}, $_[1]);
++ my $group_sequence = $_[1];
++
++ die "Group sequence must be defined" if !defined($group_sequence);
++
++ cproton_perl::pn_message_set_group_sequence($self->{_impl}, int($_[1]));
+ }
+
+ sub get_group_sequence {
+diff --git a/proton-c/bindings/perl/perl.i b/proton-c/bindings/perl/perl.i
+index 6ac0ba8..27799d3 100644
+--- a/proton-c/bindings/perl/perl.i
++++ b/proton-c/bindings/perl/perl.i
+@@ -18,6 +18,105 @@ typedef int int32_t;
+
+ %include <cstring.i>
+
++%typemap(in) pn_atom_t
++{
++ if(!$input)
++ {
++ $1.type = PN_NULL;
++ }
++ else
++ {
++ if(SvIOK($input)) // an integer value
++ {
++ $1.type = PN_LONG;
++ $1.u.as_long = SvIV($input);
++ }
++ else if(SvNOK($input)) // a floating point value
++ {
++ $1.type = PN_FLOAT;
++ $1.u.as_float = SvNV($input);
++ }
++ else if(SvPOK($input)) // a string type
++ {
++ STRLEN len;
++ char* ptr;
++
++ ptr = SvPV($input, len);
++ $1.type = PN_STRING;
++ $1.u.as_bytes.start = ptr;
++ $1.u.as_bytes.size = strlen(ptr); // len;
++ }
++ }
++}
++
++%typemap(out) pn_atom_t
++{
++ SV* obj = sv_newmortal();
++
++ switch($1.type)
++ {
++ case PN_NULL:
++ sv_setsv(obj, &PL_sv_undef);
++ break;
++
++ case PN_BYTE:
++ sv_setiv(obj, (IV)$1.u.as_byte);
++ break;
++
++ case PN_INT:
++ sv_setiv(obj, (IV)$1.u.as_int);
++ break;
++
++ case PN_LONG:
++ sv_setiv(obj, (IV)$1.u.as_long);
++ break;
++
++ case PN_STRING:
++ {
++ if($1.u.as_bytes.size > 0)
++ {
++ sv_setpvn(obj, $1.u.as_bytes.start, $1.u.as_bytes.size);
++ }
++ else
++ {
++ sv_setsv(obj, &PL_sv_undef);
++ }
++ }
++ break;
++ }
++
++ $result = obj;
++ // increment the hidden stack reference before returning
++ argvi++;
++}
++
++%typemap(in) pn_bytes_t
++{
++ STRLEN len;
++ char* ptr;
++
++ ptr = SvPV($input, len);
++ $1.start = ptr;
++ $1.size = strlen(ptr);
++}
++
++%typemap(out) pn_bytes_t
++{
++ SV* obj = sv_newmortal();
++
++ if($1.size > 0)
++ {
++ sv_setpvn(obj, $1.start, $1.size);
++ }
++ else
++ {
++ sv_setsv(obj, &PL_sv_undef);
++ }
++
++ $result = obj;
++ argvi++;
++}
++
+ %cstring_output_withsize(char *OUTPUT, size_t *OUTPUT_SIZE)
+ %cstring_output_allocate_size(char **ALLOC_OUTPUT, size_t *ALLOC_SIZE, free(*$1));
+
+--
+1.8.1
+
diff --git a/02-PROTON-176-Provide-Perl-unit-tests.patch
b/02-PROTON-176-Provide-Perl-unit-tests.patch
new file mode 100644
index 0000000..5645cd9
--- /dev/null
+++ b/02-PROTON-176-Provide-Perl-unit-tests.patch
@@ -0,0 +1,317 @@
+From 704d347656caeec183939a28c0cd1213206a1344 Mon Sep 17 00:00:00 2001
+From: mcpierce <mcpierce@13f79535-47bb-0310-9956-ffa450edef68>
+Date: Wed, 16 Jan 2013 21:48:19 +0000
+Subject: [PATCH 3/7] PROTON-176: Provide Perl unit tests.
+
+git-svn-id:
https://svn.apache.org/repos/asf/qpid/proton/trunk@1434421
13f79535-47bb-0310-9956-ffa450edef68
+---
+ proton-c/bindings/perl/ChangeLog | 5 +-
+ proton-c/bindings/perl/tests/message.t | 254 +++++++++++++++++++++++++++++++++
+ proton-c/bindings/perl/tests/utils.pm | 21 +++
+ 3 files changed, 279 insertions(+), 1 deletion(-)
+ create mode 100644 proton-c/bindings/perl/tests/message.t
+ create mode 100644 proton-c/bindings/perl/tests/utils.pm
+
+diff --git a/proton-c/bindings/perl/ChangeLog b/proton-c/bindings/perl/ChangeLog
+index 1df5637..053ba7c 100644
+--- a/proton-c/bindings/perl/ChangeLog
++++ b/proton-c/bindings/perl/ChangeLog
+@@ -1,4 +1,7 @@
+-version 0.3: (TBA)
++version 0.4: (TBD)
++ * Unit tests for qpid::proton::Message.
++
++version 0.3: (15 January 2013)
+ * No language-specific features developed in this release.
+
+ version 0.2: (30 November 2012)
+diff --git a/proton-c/bindings/perl/tests/message.t
b/proton-c/bindings/perl/tests/message.t
+new file mode 100644
+index 0000000..ee55361
+--- /dev/null
++++ b/proton-c/bindings/perl/tests/message.t
+@@ -0,0 +1,254 @@
++#!/usr/bin/env perl -w
++#
++# Licensed to the Apache Software Foundation (ASF) under one
++# or more contributor license agreements. See the NOTICE file
++# distributed with this work for additional information
++# regarding copyright ownership. The ASF licenses this file
++# to you under the Apache License, Version 2.0 (the
++# "License"); you may not use this file except in compliance
++# with the License. You may obtain a copy of the License at
++#
++#
http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing,
++# software distributed under the License is distributed on an
++# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++# KIND, either express or implied. See the License for the
++# specific language governing permissions and limitations
++# under the License.
++#
++
++use Test::More qw(no_plan);
++use Test::Exception;
++
++require 'utils.pm';
++
++BEGIN {use_ok('qpid_proton');}
++require_ok('qpid_proton');
++
++# Create a new message.
++my $message = qpid::proton::Message->new();
++isa_ok($message, 'qpid::proton::Message');
++
++# Verify the message mutators.
++
++# durable
++$message->set_durable(1);
++ok($message->get_durable(), 'Durable can be set');
++$message->set_durable(0);
++ok(!$message->get_durable(), 'Durable can be unset');
++
++# priority
++my $priority = int(rand(256) + 1);
++
++dies_ok(sub {$message->set_priority('abc')}, 'Priority must be
numeric');
++dies_ok(sub {$message->set_priority(0 - $priority)}, 'Priority cannot be
negative');
++
++$message->set_priority(0);
++ok($message->get_priority() == 0, 'Priority can be zero');
++$message->set_priority($priority);
++ok($message->get_priority() == $priority, 'Priority can be positive');
++
++# Time to live
++my $ttl = int(rand(65535) + 1);
++
++dies_ok(sub {$message->set_ttl('def')}, 'TTL must be numeric');
++dies_ok(sub {$message->set_ttl(0 - $ttl)}, 'TTL cannot be negative');
++
++$message->set_ttl(0);
++ok($message->get_ttl() == 0, 'TTL can be zero');
++$message->set_ttl($ttl);
++ok($message->get_ttl() == $ttl, 'TTL can be postive');
++
++# first acquirer
++$message->set_first_acquirer(1);
++ok($message->get_first_acquirer(), 'First acquirer can be set');
++$message->set_first_acquirer(0);
++ok(!$message->get_first_acquirer(), 'First acquirer can be unset');
++
++# delivery count
++my $delivery_count = int(rand(65535) + 1);
++
++dies_ok(sub {$message->set_delivery_count("abc");},
++ 'Messages cannot have non-numeric delivery counts');
++dies_ok(sub {$message->set_delivery_count(0 - $delivery_count)},
++ 'Messages cannot have negative delivery counts');
++$message->set_delivery_count(0);
++ok($message->get_delivery_count() == 0, 'Delivery count can be zero');
++$message->set_delivery_count($delivery_count);
++ok ($message->get_delivery_count() == $delivery_count, 'Delivery count can be
postiive');
++
++# message id
++my $message_id = random_string(16);
++
++dies_ok (sub {$message->set_id(undef);},
++ 'Message id cannot be null');
++$message->set_id($message_id);
++ok($message->get_id(), 'Message id was set');
++ok($message->get_id() eq $message_id, 'Message id was set correctly');
++
++# user id
++my $user_id = random_string(16);
++
++dies_ok (sub {$message->set_user_id(undef);},
++ 'User id cannot be null');
++$message->set_user_id($user_id);
++ok($message->get_user_id(), 'User id was set');
++ok($message->get_user_id() eq $user_id, 'User id was set correctly');
++
++# address
++my $address = "amqp://0.0.0.0";
++
++$message->set_address(undef);
++ok(!$message->get_address(), 'Address can be null');
++
++$message->set_address($address);
++ok($message->get_address() eq $address, 'Address is set correctly');
++
++# subject
++my $subject = random_string(25);
++
++$message->set_subject(undef);
++ok(!$message->get_subject(), 'Subject can be null');
++
++$message->set_subject($subject);
++ok($message->get_subject() eq $subject, 'Subject was set correctly');
++
++# reply to
++$reply_to = "amqp://0.0.0.0";
++
++$message->set_reply_to(undef);
++ok(!$message->get_reply_to(), "Reply to can be null");
++
++$message->set_reply_to($reply_to);
++ok($message->get_reply_to() eq $reply_to, 'Reply to was set correctly');
++
++# correlation id
++my $correlation_id = random_string(16);
++
++$message->set_correlation_id(undef);
++ok(!$message->get_correlation_id(), 'Correlation id can be null');
++
++$message->set_correlation_id($correlation_id);
++ok($message->get_correlation_id() eq $correlation_id,
++ 'Correlation id was set correctly');
++
++# content type
++my $content_type = "text/" . random_string(12);
++
++$message->set_content_type(undef);
++ok(!$message->get_content_type(), 'Content type can be null');
++
++$message->set_content_type($content_type);
++ok($message->get_content_type() eq $content_type,
++ 'Content type was set correctly');
++
++# content encoding
++my $content_encoding = random_string(16);
++
++$message->set_content_encoding(undef);
++ok(!$message->get_content_encoding(), 'Content encoding can be null');
++
++$message->set_content_encoding($content_encoding);
++ok($message->get_content_encoding() eq $content_encoding,
++ 'Content encoding was set correctly');
++
++# expiry time
++my $expiry_time = random_timestamp();
++
++dies_ok(sub {$message->set_expiry_time(undef);},
++ 'Expiry cannot be null');
++
++dies_ok(sub {$message->set_expiry_time(0 - $expiry_time);},
++ 'Expiry cannot be negative');
++
++$message->set_expiry_time(0);
++ok($message->get_expiry_time() == 0,
++ 'Expiry time can be zero');
++
++$message->set_expiry_time($expiry_time);
++ok($message->get_expiry_time() == int($expiry_time),
++ 'Expiry time was set correctly');
++
++# creation time
++my $creation_time = random_timestamp();
++
++dies_ok(sub {$message->set_creation_time(undef);},
++ 'Creation time cannot be null');
++
++dies_ok(sub {$message->set_creation_time(0 - $creation_time);},
++ 'Creation time cannot be negative');
++
++$message->set_creation_time($creation_time);
++ok($message->get_creation_time() == $creation_time,
++ 'Creation time was set correctly');
++
++# group id
++my $group_id = random_string(16);
++
++$message->set_group_id(undef);
++ok(!$message->get_group_id(), 'Group id can be null');
++
++$message->set_group_id($group_id);
++ok($message->get_group_id() eq $group_id,
++ 'Group id was set correctly');
++
++# group sequence
++my $group_sequence = rand(2**31) + 1;
++
++dies_ok(sub {$message->set_group_sequence(undef);},
++ 'Sequence id cannot be null');
++
++$message->set_group_sequence(0 - $group_sequence);
++ok($message->get_group_sequence() == int(0 - $group_sequence),
++ 'Group sequence can be negative');
++
++$message->set_group_sequence(0);
++ok($message->get_group_sequence() == 0,
++ 'Group sequence can be zero');
++
++$message->set_group_sequence($group_sequence);
++ok($message->get_group_sequence() == int($group_sequence),
++ 'Group sequence can be positive');
++
++# reply to group id
++my $reply_to_group_id = random_string(16);
++
++$message->set_reply_to_group_id(undef);
++ok(!$message->get_reply_to_group_id(), 'Reply-to group id can be null');
++
++$message->set_reply_to_group_id($reply_to_group_id);
++ok($message->get_reply_to_group_id() eq $reply_to_group_id,
++ 'Reply-to group id was set correctly');
++
++# format
++my @formats = ($qpid::proton::Message::DATA_FORMAT,
++ $qpid::proton::Message::TEXT_FORMAT,
++ $qpid::proton::Message::AMQP_FORMAT,
++ $qpid::proton::Message::JSON_FORMAT);
++
++dies_ok(sub {$message->set_format(undef);}, 'Format cannot be null');
++
++foreach (@formats)
++{
++ my $format = $_;
++
++ $message->set_format($format);
++ ok($message->get_format() == $format,
++ 'Format was set correctly');
++}
++
++# reset the format
++$message->set_format($qpid::proton::Message::TEXT_FORMAT);
++
++# content
++my $content_size = rand(512);
++my $content = random_string($content_size);
++
++$message->set_content(undef);
++ok(!$message->get_content(), 'Content can be null');
++
++$message->set_content($content);
++ok($message->get_content() eq $content,
++ 'Content was saved correctly');
++
+diff --git a/proton-c/bindings/perl/tests/utils.pm
b/proton-c/bindings/perl/tests/utils.pm
+new file mode 100644
+index 0000000..953e4c5
+--- /dev/null
++++ b/proton-c/bindings/perl/tests/utils.pm
+@@ -0,0 +1,21 @@
++
++sub random_string
++{
++ my $len=$_[0];
++
++ my
@chars=('a'..'z','A'..'Z','0'..'9','_');
++ my $result;
++ foreach (1..$len) {
++ $result .= $chars[rand @chars];
++ }
++ return $result;
++}
++
++sub random_timestamp
++{
++ my $result = rand(2**63) + 1;
++
++ return $result;
++}
++
++1;
+--
+1.8.1
+
diff --git a/03-PROTON-176-Add-unit-tests-for-qpid-proton-Messenger-.patch
b/03-PROTON-176-Add-unit-tests-for-qpid-proton-Messenger-.patch
new file mode 100644
index 0000000..2295398
--- /dev/null
+++ b/03-PROTON-176-Add-unit-tests-for-qpid-proton-Messenger-.patch
@@ -0,0 +1,180 @@
+From d6253e0ae5a2afcecb431dbd2e6076934a11be22 Mon Sep 17 00:00:00 2001
+From: mcpierce <mcpierce@13f79535-47bb-0310-9956-ffa450edef68>
+Date: Fri, 18 Jan 2013 20:56:30 +0000
+Subject: [PATCH 4/7] PROTON-176: Add unit tests for qpid::proton::Messenger in
+ Perl.
+
+git-svn-id:
https://svn.apache.org/repos/asf/qpid/proton/trunk@1435339
13f79535-47bb-0310-9956-ffa450edef68
+---
+ proton-c/bindings/perl/ChangeLog | 1 +
+ proton-c/bindings/perl/tests/messenger.t | 147 +++++++++++++++++++++++++++++++
+ 2 files changed, 148 insertions(+)
+ create mode 100644 proton-c/bindings/perl/tests/messenger.t
+
+diff --git a/proton-c/bindings/perl/ChangeLog b/proton-c/bindings/perl/ChangeLog
+index 053ba7c..3c224f8 100644
+--- a/proton-c/bindings/perl/ChangeLog
++++ b/proton-c/bindings/perl/ChangeLog
+@@ -1,5 +1,6 @@
+ version 0.4: (TBD)
+ * Unit tests for qpid::proton::Message.
++ * Unit tests for qpid::proton::Messenger.
+
+ version 0.3: (15 January 2013)
+ * No language-specific features developed in this release.
+diff --git a/proton-c/bindings/perl/tests/messenger.t
b/proton-c/bindings/perl/tests/messenger.t
+new file mode 100644
+index 0000000..0e6f090
+--- /dev/null
++++ b/proton-c/bindings/perl/tests/messenger.t
+@@ -0,0 +1,147 @@
++#!/usr/bin/env perl -w
++#
++# Licensed to the Apache Software Foundation (ASF) under one
++# or more contributor license agreements. See the NOTICE file
++# distributed with this work for additional information
++# regarding copyright ownership. The ASF licenses this file
++# to you under the Apache License, Version 2.0 (the
++# "License"); you may not use this file except in compliance
++# with the License. You may obtain a copy of the License at
++#
++#
http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing,
++# software distributed under the License is distributed on an
++# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++# KIND, either express or implied. See the License for the
++# specific language governing permissions and limitations
++# under the License.
++#
++
++use Test::More qw(no_plan);
++use Test::Exception;
++
++require 'utils.pm';
++
++BEGIN {use_ok('qpid_proton');}
++require_ok('qpid_proton');
++
++# Create a new message.
++my $messenger = qpid::proton::Messenger->new();
++isa_ok($messenger, 'qpid::proton::Messenger');
++
++# name
++ok($messenger->get_name(), 'Messenger has a default name');
++
++{
++ my $name = random_string(16);
++ my $messenger1 = qpid::proton::Messenger->new($name);
++
++ ok($messenger1->get_name() eq $name, 'Messenger saves name correctly');
++}
++
++# certificate
++my $certificate = random_string(255);
++
++$messenger->set_certificate(undef);
++ok(!$messenger->get_certificate(), 'Certificate can be null');
++
++$messenger->set_certificate($certificate);
++ok($messenger->get_certificate() eq $certificate,
++ 'Certificate was set correctly');
++
++# private key
++my $key = random_string(255);
++
++$messenger->set_private_key(undef);
++ok(!$messenger->get_private_key(), 'Private key can be null');
++
++$messenger->set_private_key($key);
++ok($messenger->get_private_key() eq $key, 'Private key was set correctly');
++
++# password
++my $password = random_string(64);
++
++$messenger->set_password(undef);
++ok(!$messenger->get_password(), 'Password can be null');
++
++$messenger->set_password($password);
++ok($messenger->get_password() eq $password, 'Password set correctly');
++
++# trusted certificates
++my $trusted_certificate = random_string(255);
++
++$messenger->set_trusted_certificates(undef);
++ok(!$messenger->get_trusted_certificates(), 'Trusted certificates can be
null');
++
++$messenger->set_trusted_certificates($trusted_certificate);
++ok($messenger->get_trusted_certificates() eq $trusted_certificate,
++ 'Trusted certificates was set correctly');
++
++# timeout
++my $timeout = rand(2**31) + 1;
++
++$messenger->set_timeout(undef);
++ok($messenger->get_timeout() == 0, 'Null timeout is treated as 0');
++
++$messenger->set_timeout(0 - $timeout);
++ok($messenger->get_timeout() == int(0 - $timeout), 'Timeout can be
negative');
++
++$messenger->set_timeout(0);
++ok($messenger->get_timeout() == 0, 'Timeout can be zero');
++
++$messenger->set_timeout($timeout);
++ok($messenger->get_timeout() == int($timeout), 'Timeout can be positive');
++
++# accept mode
++my @accept_modes = ($qpid::proton::Messenger::AUTO_ACCEPT,
++ $qpid::proton::Messenger::MANUAL_ACCEPT);
++
++dies_ok(sub {$messenger->set_accept_mode(undef);},
++ 'Accept mode cannot be null');
++dies_ok(sub {$messenger->set_accept_mode($messenger);},
++ 'Accept mode rejects an arbitrary value');
++
++foreach (@accept_modes)
++{
++ my $mode = $_;
++
++ $messenger->set_accept_mode($mode);
++ ok($messenger->get_accept_mode() eq $mode,
++ 'Accept mode was set correctly');
++}
++
++# outgoing window
++my $outgoing_window = rand(2**9);
++
++$messenger->set_outgoing_window(undef);
++ok($messenger->get_outgoing_window() == 0, 'Null outgoing window is treated as
zero');
++
++$messenger->set_outgoing_window(0);
++ok($messenger->get_outgoing_window() == 0, 'Outgoing window can be zero');
++
++$messenger->set_outgoing_window(0 - $outgoing_window);
++ok($messenger->get_outgoing_window() == int(0 - $outgoing_window),
++ 'Outgoing window can be negative');
++
++$messenger->set_outgoing_window($outgoing_window);
++ok($messenger->get_outgoing_window() == int($outgoing_window),
++ 'Outgoing window can be positive');
++
++# incoming window
++my $incoming_window = rand(2**9);
++
++$messenger->set_incoming_window(undef);
++ok($messenger->get_incoming_window() == 0, 'Null incoming window is treated as
zero');
++
++$messenger->set_incoming_window(0);
++ok($messenger->get_incoming_window() == 0, 'Incoming window can be zero');
++
++$messenger->set_incoming_window(0 - $incoming_window);
++ok($messenger->get_incoming_window() == int(0 - $incoming_window),
++ 'Incoming window can be negative');
++
++$messenger->set_incoming_window($incoming_window);
++ok($messenger->get_incoming_window() == int($incoming_window),
++ 'Incoming window can be positive');
++
+--
+1.8.1
+
diff --git a/04-NO-JIRA-Fixed-the-package-name-for-Perl.patch
b/04-NO-JIRA-Fixed-the-package-name-for-Perl.patch
new file mode 100644
index 0000000..f978ac3
--- /dev/null
+++ b/04-NO-JIRA-Fixed-the-package-name-for-Perl.patch
@@ -0,0 +1,28 @@
+From 2c00eee90ef860b74cc97dfbb9726128d554275b Mon Sep 17 00:00:00 2001
+From: mcpierce <mcpierce@13f79535-47bb-0310-9956-ffa450edef68>
+Date: Wed, 30 Jan 2013 22:16:12 +0000
+Subject: [PATCH 6/7] NO-JIRA: Fixed the package name for Perl.
+
+Made it cproton_perl to properly match the bindings generated by Swig.
+
+git-svn-id:
https://svn.apache.org/repos/asf/qpid/proton/trunk@1440709
13f79535-47bb-0310-9956-ffa450edef68
+---
+ proton-c/bindings/perl/Makefile.PL | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/proton-c/bindings/perl/Makefile.PL b/proton-c/bindings/perl/Makefile.PL
+index 2df9893..e06ccd5 100644
+--- a/proton-c/bindings/perl/Makefile.PL
++++ b/proton-c/bindings/perl/Makefile.PL
+@@ -3,7 +3,7 @@
+ use ExtUtils::MakeMaker;
+
+ WriteMakefile(
+- NAME => 'qpid::cproton',
++ NAME => 'cproton_perl',
+ DISTNAME => 'perl-qpid_proton',
+ VERSION => '0.3',
+ PREREQ_PM => {},
+--
+1.8.1
+
diff --git a/05-NO-JIRA-Removed-Version.pm-and-CMakeLists.txt-from-t.patch
b/05-NO-JIRA-Removed-Version.pm-and-CMakeLists.txt-from-t.patch
new file mode 100644
index 0000000..21757a2
--- /dev/null
+++ b/05-NO-JIRA-Removed-Version.pm-and-CMakeLists.txt-from-t.patch
@@ -0,0 +1,26 @@
+From 76ce74b46d46a3dc72783f1b7be587fa64617ce9 Mon Sep 17 00:00:00 2001
+From: "Darryl L. Pierce" <dpierce(a)redhat.com>
+Date: Thu, 31 Jan 2013 08:40:05 -0500
+Subject: [PATCH] NO-JIRA: Removed Version.pm and CMakeLists.txt from the Perl
+ MANIFEST.
+
+---
+ proton-c/bindings/perl/MANIFEST | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/proton-c/bindings/perl/MANIFEST b/proton-c/bindings/perl/MANIFEST
+index 726498b..e96b6a8 100644
+--- a/proton-c/bindings/perl/MANIFEST
++++ b/proton-c/bindings/perl/MANIFEST
+@@ -1,8 +1,6 @@
+ ChangeLog
+-CMakeLists.txt
+ lib/qpid/proton/Message.pm
+ lib/qpid/proton/Messenger.pm
+-lib/qpid/proton/Version.pm
+ lib/qpid_proton.pm
+ LICENSE
+ Makefile.PL
+--
+1.8.1
+
diff --git a/perl-qpid_proton.spec b/perl-qpid_proton.spec
new file mode 100644
index 0000000..e4e6654
--- /dev/null
+++ b/perl-qpid_proton.spec
@@ -0,0 +1,82 @@
+Name: perl-qpid_proton
+Version: 0.3
+Release: 2%{?dist}
+Summary: Perl language bindings for Qpid Proton
+
+License: ASL 2.0
+URL:
http://qpid.apache.org/proton/
+# The sources will show up in the official Proton release mirrors
+# after 0.3.
+Source0: perl-qpid_proton-%{version}.tar.gz
+
+BuildRequires: perl(ExtUtils::MakeMaker)
+BuildRequires: swig
+BuildRequires: qpid-proton-devel = %{version}
+BuildRequires: perl(Test::Exception)
+BuildRequires: perl(Test::More)
+
+%{?perl_default_filter}
+
+Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo
$version))
+Requires: qpid-proton = %{version}
+
+
+Patch1: 01-PROTON-176-Fixes-to-Perl-code-due-to-unit-test-failu.patch
+Patch2: 02-PROTON-176-Provide-Perl-unit-tests.patch
+Patch3: 03-PROTON-176-Add-unit-tests-for-qpid-proton-Messenger-.patch
+Patch4: 04-NO-JIRA-Fixed-the-package-name-for-Perl.patch
+Patch5: 05-NO-JIRA-Removed-Version.pm-and-CMakeLists.txt-from-t.patch
+
+
+%description
+%{summary}.
+
+
+%prep
+%setup -q
+%patch1 -p4
+%patch2 -p4
+%patch3 -p4
+%patch4 -p4
+%patch5 -p4
+
+swig -perl -I/usr/include -o cproton_perl.c perl.i
+
+
+%build
+%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS"
+make %{?_smp_mflags}
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+make install DESTDIR=$RPM_BUILD_ROOT
+find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} ';'
+find $RPM_BUILD_ROOT -type f -name '*.bs' -a -size 0 -exec rm -f {} ';'
+%{_fixperms} $RPM_BUILD_ROOT/*
+
+# delete the podfile
+rm -f $RPM_BUILD_ROOT/%{_libdir}/perl5/perllocal.pod
+
+
+%check
+make test
+
+
+%files
+%doc LICENSE TODO README
+%{perl_vendorarch}/*
+
+
+%changelog
+* Fri Feb 1 2013 Darryl L. Pierce <dpierce(a)redhat.com> - 0.3-2
+- First official release for Fedora.
+
+* Thu Jan 31 2013 Darryl L. Pierce <dpierce(a)redhat.com> - 0.3-1.1
+- Fixed version in changelog.
+- Added BRs for Test::Exception and Test::More for tests.
+- Removed unused exclusion.
+
+* Thu Jan 31 2013 Darryl L. Pierce <dpierce(a)redhat.com> - 0.3-1
+- Initial packaging of the Perl language bindings.
diff --git a/sources b/sources
index e69de29..883ae8d 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+7a336ee13e59dd1966e8555cd6c4777e perl-qpid_proton-0.3.tar.gz