1#!/usr/bin/perl -w 2 3use Net::DRI; 4use Net::DRI::Data::Raw; 5 6use Test::More tests => 2; 7eval { no warnings; require Test::LongString; Test::LongString->import(max => 100); $Test::LongString::Context=50; }; 8*{'main::is_string'}=\&main::is if $@; 9 10our $E1='<?xml version="1.0" encoding="UTF-8" standalone="no"?><epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">'; 11our $E2='</epp>'; 12our $TRID='<trID><clTRID>ABC-12345</clTRID><svTRID>54322-XYZ</svTRID></trID>'; 13 14our $R1; 15sub mysend 16{ 17 my ($transport,$count,$msg)=@_; 18 $R1=$msg->as_string(); 19 return 1; 20} 21 22our $R2; 23sub myrecv 24{ 25 return Net::DRI::Data::Raw->new_from_string($R2? $R2 : $E1.'<response>'.r().$TRID.'</response>'.$E2); 26} 27 28sub r 29{ 30 my ($c,$m)=@_; 31 return '<result code="'.($c || 1000).'"><msg>'.($m || 'Command completed successfully').'</msg></result>'; 32} 33 34#################################################################################################### 35 36my $dri=Net::DRI::TrapExceptions->new(10); 37$dri->{trid_factory}=sub { return 'ABC-12345'; }; 38$dri->add_registry('NAME'); 39$dri->target('NAME')->add_current_profile('p1','test=epp',{f_send => \&mysend, f_recv => \&myrecv}); 40 41is($dri->verify_name_domain('firstname.lastname.name','info'),'','firstname.lastname.name registrability'); 42is($dri->verify_name_domain('lastname.name','info'),'','lastname.name registrability'); 43 44#################################################################################################### 45 46exit 0; 47