1#!/usr/bin/perl -w 2 3use Net::DRI; 4use Net::DRI::Data::Raw; 5 6use Test::More tests => 1; 7 8our $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">'; 9our $E2='</epp>'; 10our $TRID='<trID><clTRID>ABC-12345</clTRID><svTRID>54322-XYZ</svTRID></trID>'; 11 12our $R1; 13sub mysend 14{ 15 my ($transport,$count,$msg)=@_; 16 $R1=$msg->as_string(); 17 return 1; 18} 19 20our $R2; 21sub myrecv 22{ 23 return Net::DRI::Data::Raw->new_from_string($R2? $R2 : $E1.'<response>'.r().$TRID.'</response>'.$E2); 24} 25 26my $dri=Net::DRI->new(10); 27$dri->{trid_factory}=sub { return 'ABC-12345'; }; 28$dri->add_registry('VNDS'); 29$dri->target('VNDS')->add_current_profile('p1','test=EPP',{f_send=>\&mysend,f_recv=>\&myrecv},{extensions=>['Net::DRI::Protocol::EPP::Extensions::VeriSign::Sync']}); 30 31######################################################################################################### 32## Example taken from draft-hollenbeck-epp-sync-01, updated (removed empty <domain:chg/> 33 34my $toc=$dri->local_object('changes'); 35$toc->set('sync','05-31'); 36my $rc=$dri->domain_update('example2.com',$toc); 37is($R1,$E1.'<command><update><domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd"><domain:name>example2.com</domain:name></domain:update></update><extension><sync:update xmlns:sync="http://www.verisign.com/epp/sync-1.0" xsi:schemaLocation="http://www.verisign.com/epp/sync-1.0 sync-1.0.xsd"><sync:expMonthDay>--05-31</sync:expMonthDay></sync:update></extension><clTRID>ABC-12345</clTRID></command>'.$E2,'domain_update build'); 38 39exit 0; 40 41sub r 42{ 43 my ($c,$m)=@_; 44 return '<result code="'.($c || 1000).'"><msg>'.($m || 'Command completed successfully').'</msg></result>'; 45} 46