[OpenSRF-GIT] OpenSRF branch rel_2_1 updated. osrf_rel_2_1_2-12-g8bc9c80

Evergreen Git git at git.evergreen-ils.org
Mon Dec 16 11:20:58 EST 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "OpenSRF".

The branch, rel_2_1 has been updated
       via  8bc9c804ff8829866d43a7e421e97b248ea69ff4 (commit)
       via  f8bf447ec56cbc6dd85741de363a19503464197e (commit)
       via  d9736002b13d12bda7ce66c1de0198c18be13a91 (commit)
       via  f60d276f6b482afeb2639a9d2dac6e80092e750b (commit)
      from  28d393256c7ef60c84fd17f757b5cd6c0151a056 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8bc9c804ff8829866d43a7e421e97b248ea69ff4
Author: Mike Rylander <mrylander at gmail.com>
Date:   Tue Dec 3 09:57:39 2013 -0500

    LP#1257264: Use the built-in JSON-y test for bools
    
    This removes a dependency on internal details of JSON::XS's
    implementation of Boolean types which changed with the release
    of JSON::XS 3.0.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>
    Signed-off-by: Jeff Godin <jgodin at tadl.org>

diff --git a/src/perl/lib/OpenSRF/Utils/JSON.pm b/src/perl/lib/OpenSRF/Utils/JSON.pm
index 58a7a02..a83e9d1 100644
--- a/src/perl/lib/OpenSRF/Utils/JSON.pm
+++ b/src/perl/lib/OpenSRF/Utils/JSON.pm
@@ -160,13 +160,13 @@ sub JSONObject2Perl {
         # is a hash, but no class marker; simply revivify innards
         for my $k (keys %$obj) {
             $obj->{$k} = $pkg->JSONObject2Perl($obj->{$k})
-              unless ref $obj->{$k} eq 'JSON::XS::Boolean';
+              unless JSON::XS::is_bool $obj->{$k};
         }
     } elsif ( ref $obj eq 'ARRAY' ) {
         # not a hash; an array. revivify.
         for my $i (0..scalar(@$obj) - 1) {
             $obj->[$i] = $pkg->JSONObject2Perl($obj->[$i])
-              unless (ref $obj->[$i] eq 'JSON::XS::Boolean');
+              unless JSON::XS::is_bool $obj->[$i];
               # FIXME? This does nothing except leave any Booleans in
               # place, without recursively calling this sub on
               # them. I'm not sure if that's what's supposed to
@@ -205,8 +205,7 @@ sub perl2JSONObject {
     my ($pkg, $obj) = @_;
     my $ref = ref $obj;
 
-    return $obj unless $ref;
-    return $obj if $ref eq 'JSON::XS::Boolean';
+    return $obj if !$ref or JSON::XS::is_bool $obj;
 
     my $jsonobj;
 

commit f8bf447ec56cbc6dd85741de363a19503464197e
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Tue Dec 3 09:43:54 2013 -0800

    LP#1257264: make test cases for JSON::XS Boolean-ness more generic
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>
    Signed-off-by: Jeff Godin <jgodin at tadl.org>

diff --git a/src/perl/t/09-Utils-JSON.t b/src/perl/t/09-Utils-JSON.t
index 7b5908b..d074d5e 100644
--- a/src/perl/t/09-Utils-JSON.t
+++ b/src/perl/t/09-Utils-JSON.t
@@ -76,8 +76,8 @@ is (OpenSRF::Utils::JSON->perl2JSONObject(),      undef, "Returns argument unles
 is (OpenSRF::Utils::JSON->perl2JSONObject(3),     3,     "Returns argument unless it's a ref");
 is (OpenSRF::Utils::JSON->perl2JSONObject('foo'), 'foo', "Returns argument unless it's a ref");
 
-is (ref OpenSRF::Utils::JSON->true, 'JSON::XS::Boolean');
-is (OpenSRF::Utils::JSON->perl2JSONObject(OpenSRF::Utils::JSON->true), '1', "Returns argument if it's a JSON::XS::Boolean");
+ok (JSON::XS::is_bool(OpenSRF::Utils::JSON->true), 'OpenSRF::Utils::JSON->true is a Boolean according to JSON::XS');
+is (OpenSRF::Utils::JSON->perl2JSONObject(OpenSRF::Utils::JSON->true), '1', "Returns argument if it's a Boolean according to JSON");
 
 my $hashref = { foo => 'bar' };
 is (UNIVERSAL::isa($hashref,'HASH'), 1);
@@ -114,13 +114,13 @@ is (OpenSRF::Utils::JSON->JSONObject2Perl($coderef), $coderef, "Returns argument
 
 is_deeply (OpenSRF::Utils::JSON->JSONObject2Perl([11, 12]), [11, 12], "Arrayrefs get reconstructed as themselves");
 is_deeply (OpenSRF::Utils::JSON->JSONObject2Perl([11, OpenSRF::Utils::JSON->true, 12]), [11, OpenSRF::Utils::JSON->true, 12],
-           "Even when they contain JSON::XS::Booleans; those just don't get recursed upon");
-           # note: [11, 1, 12] doesn't work here, even though you can do math on J:X:Booleans
+           "Even when they contain JSON::XS  Booleans; those just don't get recursed upon");
+           # note: [11, 1, 12] doesn't work here, even though you can do math on J::X Booleans
 
 is_deeply (OpenSRF::Utils::JSON->JSONObject2Perl($hashref), { foo => 'bar' }, "Hashrefs without the class flag also get turned into themselves");
 is_deeply (OpenSRF::Utils::JSON->JSONObject2Perl({ foo => OpenSRF::Utils::JSON->true, bar => 'baz' }), 
            { foo => OpenSRF::Utils::JSON->true, bar => 'baz'},
-           "Even when they contain JSON::XS::Booleans; those just don't get recursed upon");
+           "Even when they contain JSON::XS  Booleans; those just don't get recursed upon");
 
 my $vivobj = OpenSRF::Utils::JSON->JSONObject2Perl($jsonobj);
 is (ref $vivobj, 'OpenSRF::DomainObject::oilsException');

commit d9736002b13d12bda7ce66c1de0198c18be13a91
Author: Mike Rylander <mrylander at gmail.com>
Date:   Thu May 16 10:17:15 2013 -0400

    Protect subrequests from post-complete messages
    
    Subrequests (AKA method_lookup()-based API calls) sometimes append
    final-lvalue responses to the response list even after respond_complete()
    has been called from within the implementation method.  This commit
    discards all post-respond_complete values, protecting against extra,
    spurious values being returned to the ultimate client.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/src/perl/lib/OpenSRF/AppSession.pm b/src/perl/lib/OpenSRF/AppSession.pm
index d19085f..fea28ee 100644
--- a/src/perl/lib/OpenSRF/AppSession.pm
+++ b/src/perl/lib/OpenSRF/AppSession.pm
@@ -1076,15 +1076,22 @@ package OpenSRF::AppSubrequest;
 
 sub respond {
 	my $self = shift;
+	return if $self->complete;
+
 	my $resp = shift;
 	push @{$$self{resp}}, $resp if (defined $resp);
 }
-sub respond_complete { respond(@_); }
+
+sub respond_complete {
+	my $self = shift;
+	$self->respond(@_);
+	$self->complete(1);
+}
 
 sub new {
 	my $class = shift;
 	$class = ref($class) || $class;
-	return bless({resp => [], @_}, $class);
+	return bless({complete => 0, resp => [], @_}, $class);
 }
 
 sub responses { @{$_[0]->{resp}} }
@@ -1096,6 +1103,13 @@ sub session {
 	return $x->{session};
 }
 
+sub complete {
+	my $x = shift;
+	my $c = shift;
+	$x->{complete} = $c if ($c);
+	return $x->{complete};
+}
+
 sub status {}
 
 

commit f60d276f6b482afeb2639a9d2dac6e80092e750b
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Mon Dec 16 08:08:51 2013 -0800

    LP#1180849: test case - ignoring subrequest responses after respond_complete()
    
    This patch adds a regression test for verifying that subrequests
    ignore additional responses after respond_complete() is called.
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>
    
    Conflicts:
    	src/perl/t/02-AppSession.t

diff --git a/src/perl/t/02-AppSession.t b/src/perl/t/02-AppSession.t
index 1ac6673..22befb4 100644
--- a/src/perl/t/02-AppSession.t
+++ b/src/perl/t/02-AppSession.t
@@ -1,7 +1,15 @@
 #!perl -T
 
-use Test::More tests => 1;
+use Test::More tests => 2;
 
 BEGIN {
 	use_ok( 'OpenSRF::AppSession' );
 }
+
+my $subreq = OpenSRF::AppSubrequest->new();
+$subreq->respond('a');
+$subreq->respond('b');
+$subreq->respond_complete();
+$subreq->respond('c');
+my @responses = $subreq->responses();
+is_deeply(\@responses, ['a', 'b'], 'further responses ignored after respond_complete() is called');

-----------------------------------------------------------------------

Summary of changes:
 src/perl/lib/OpenSRF/AppSession.pm |   18 ++++++++++++++++--
 src/perl/lib/OpenSRF/Utils/JSON.pm |    7 +++----
 src/perl/t/02-AppSession.t         |   10 +++++++++-
 src/perl/t/09-Utils-JSON.t         |   10 +++++-----
 4 files changed, 33 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
OpenSRF


More information about the opensrf-commits mailing list