use Test::More tests => 8; use_ok( 'HTTP::OAI' ); use_ok( 'HTTP::OAI::Metadata::OAI_DC' ); use XML::LibXML; my $expected = < 0000-00-00T00:00:00Zhttp://localhost/path/script
oai:arXiv.org:acc-phys/94110012004-06-22T17:51:18Za:aa:b
Symplectic Computation of Lyapunov Exponents Habib, Salman Ryne, Robert D. Accelerator Physics A recently developed method for the calculation of Lyapunov exponents of dynamical systems is described. The method is applicable whenever the linearized dynamics is Hamiltonian. By utilizing the exponential representation of symplectic matrices, this approach avoids the renormalization and reorthogonalization procedures necessary in usual techniques. It is also easily extendible to damped systems. The method is illustrated by considering two examples of physical interest: a model system that describes the beam halo in charged particle beams and the driven van der Pol oscillator. Comment: 12 pages, uuencoded PostScript (figures included) 1994-10-31 text http://arXiv.org/abs/acc-phys/9411001
EOF my $r = new HTTP::OAI::GetRecord( requestURL=>'http://localhost/path/script', responseDate=>'0000-00-00T00:00:00Z' ); my $rec = new HTTP::OAI::Record(); my $str_header = <
oai:arXiv.org:acc-phys/9411001 2004-06-22T17:51:18Z a:a a:b
EOF $rec->header->dom(XML::LibXML->new()->parse_string($str_header)); ok($rec->identifier eq 'oai:arXiv.org:acc-phys/9411001', 'header/identifier'); ok($rec->datestamp eq '2004-06-22T17:51:18Z', 'header/datestamp'); ok($rec->status eq 'deleted', 'header/status'); my @sets = $rec->header->setSpec; ok($sets[0] eq 'a:a', 'header/setSpec'); my $str = < Symplectic Computation of Lyapunov Exponents Habib, Salman Ryne, Robert D. Accelerator Physics A recently developed method for the calculation of Lyapunov exponents of dynamical systems is described. The method is applicable whenever the linearized dynamics is Hamiltonian. By utilizing the exponential representation of symplectic matrices, this approach avoids the renormalization and reorthogonalization procedures necessary in usual techniques. It is also easily extendible to damped systems. The method is illustrated by considering two examples of physical interest: a model system that describes the beam halo in charged particle beams and the driven van der Pol oscillator. Comment: 12 pages, uuencoded PostScript (figures included) 1994-10-31 text http://arXiv.org/abs/acc-phys/9411001 EOF $rec->metadata(new HTTP::OAI::Metadata()); my $parser = XML::LibXML::SAX::Parser->new(Handler=>$rec->metadata); $parser->parse_string($str); $r->record($rec); #warn $r->toDOM->toString; { # hopefully if we can re-parse our own output we're ok, because we can't # compare against the ever changing XML output my $str = $r->toDOM->toString; my $_r = HTTP::OAI::GetRecord->new(handlers=>{ metadata=>'HTTP::OAI::Metadata::OAI_DC' }); $_r->parse_string($str); is($_r->record->metadata->dc->{creator}->[1], 'Ryne, Robert D.', 'toDOM'); } SKIP: { eval { require XML::SAX::Writer }; skip "XML::SAX::Writer not installed", 1 if $@; my $output; my $w = XML::SAX::Writer->new(Output=>\$output); $r->set_handler($w); $r->generate; # SAX::Writer behaves differently :-( # ok($output eq $expected, 'XML::SAX::Writer'); ok(1); }