use Modern::Perl;
use Object::Tiny qw{ type namespace ils };
-
-use NCIP::Handler::LookupItem;
+use Module::Load;
sub new {
my $class = shift;
my $params = shift;
my $subclass = __PACKAGE__ . "::" . $params->{type};
+ load $subclass || die "Can't load module $subclass";
my $self = bless {
type => $params->{type},
namespace => $params->{namespace},
use warnings;
use File::Slurp;
-use Test::More tests => 7; # last test to print
+use Test::More tests => 9; # last test to print
use lib 'lib';
);
is( $response, 'LookupItem', 'We got lookupitem with agency' );
-my $lookupuser = read_file('t/sample_data/LookupUser.xml');
-
+my $lookupuser = read_file('t/sample_data/LookupUser.xml') || die "Cant open file";
ok( $response = $ncip->process_request($lookupuser), 'Try looking up a user' );
is( $response, 'LookupUser', 'We got lookupuser' );
$type = 'LookupUser';
ok(
- $handler =
- NCIP::Handler->new( { namespace => $namespace, type => $type } ),
- 'Create new LookupItem handler'
- );
+ $handler = NCIP::Handler->new( { namespace => $namespace, type => $type } ),
+ 'Create new LookupItem handler'
+);
ok( $response = $handler->handle() );
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+\r
+<ns1:NCIPMessage xmlns:ns1="http://www.niso.org/2008/ncip" ns1:version="http://www.niso.org/schemas/ncip/v2_01/ncip_v2_01.xsd">\r
+ <ns1:LookupUser>\r
+\r
+ <ns1:UserId>\r
+ <ns1:UserIdentifierValue>381</ns1:UserIdentifierValue>\r
+ </ns1:UserId>\r
+ \r
+ <ns1:LoanedItemsDesired/>\r
+ <ns1:RequestedItemsDesired/>\r
+ <ns1:UserFiscalAccountDesired/>\r
+\r
+ </ns1:LookupUser>\r
+</ns1:NCIPMessage>\r
+\r