File: 80network.t

package info (click to toggle)
libhttp-oai-perl 4.13-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 436 kB
  • sloc: perl: 2,599; xml: 224; makefile: 15
file content (57 lines) | stat: -rw-r--r-- 1,330 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/perl -w

use Test::More tests => 6;

use strict;
use warnings;

use HTTP::OAI;

my @repos = qw(
http://eprints.ecs.soton.ac.uk/cgi/oai2
http://www.citebase.org/oai2
http://memory.loc.gov/cgi-bin/oai2_0
);
@repos = qw(
http://eprints.ecs.soton.ac.uk/cgi/oai2
);

my $h = HTTP::OAI::Harvester->new(baseURL=>$repos[int(rand(@repos))]);

my $r;

my $dotest = defined($ENV{"HTTP_OAI_NETTESTS"});

SKIP : {
	skip "Skipping flakey net tests (set HTTP_OAI_NETTESTS env. variable to enable)", 6 unless $dotest;

	#$r = $h->GetRecord(identifier=>'oai:eprints.ecs.soton.ac.uk:23',metadataPrefix=>'oai_dc');
	#ok($r->is_success());

	
	$r = $h->Identify();
	ok($r->is_success(), "Identify: ".$r->message);

	$r = $h->ListIdentifiers(metadataPrefix=>'oai_dc');
	ok($r->is_success(), "ListIdentifiers: ".$r->message);

	$r = $h->ListMetadataFormats();
	ok($r->is_success(), "ListMetadataFormats: ".$r->message);

	$r = $h->ListRecords(metadataPrefix=>'oai_dc');
	ok($r->is_success(), "ListRecords: ".$r->message);

	$r = $h->ListSets();
	ok($r->is_success(), "ListSets: ".$r->message);

	$r = $h->ListIdentifiers(metadataPrefix => 'oai_dc');
	my $ok = 0;
	while(1)
	{
		last if $r->is_error;
		my $uri = $r->request->uri;
		my $rec = $r->next;
		$ok = 1, last if $uri ne $r->request->uri;
	}
	ok($ok, "Auto-resumption RT #69337");
}