Bug 15108: (followup) OAI-PMH provider improvements

Fixed OAI-PMH Server tests to delete any existing issues before deleting biblios,
to delete oai_sets to avoid sets in the responses and to work with UNIMARC and
NORMARC as well as MARC21.

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Ere Maijala 2017-02-23 14:44:09 +02:00 committed by Kyle M Hall
parent 9356c050b2
commit c22e18d5a0
1 changed files with 10 additions and 2 deletions

View File

@ -59,10 +59,12 @@ $schema->storage->txn_begin;
my $dbh = C4::Context->dbh;
$dbh->do("SET time_zone='+00:00'");
$dbh->do('DELETE FROM issues');
$dbh->do('DELETE FROM biblio');
$dbh->do('DELETE FROM deletedbiblio');
$dbh->do('DELETE FROM deletedbiblioitems');
$dbh->do('DELETE FROM deleteditems');
$dbh->do('DELETE FROM oai_sets');
my $date_added = DateTime->now() . 'Z';
my $date_to = substr($date_added, 0, 10) . 'T23:59:59Z';
@ -72,7 +74,13 @@ my $sth = $dbh->prepare('SELECT timestamp FROM biblioitems WHERE biblionumber=?'
# Add biblio records
foreach my $index ( 0 .. NUMBER_OF_MARC_RECORDS - 1 ) {
my $record = MARC::Record->new();
$record->append_fields( MARC::Field->new('245', '', '', 'a' => "Title $index" ) );
if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
$record->append_fields( MARC::Field->new('101', '', '', 'a' => "lng" ) );
$record->append_fields( MARC::Field->new('200', '', '', 'a' => "Title $index" ) );
} else {
$record->append_fields( MARC::Field->new('008', ' lng' ) );
$record->append_fields( MARC::Field->new('245', '', '', 'a' => "Title $index" ) );
}
my ($biblionumber) = AddBiblio($record, '');
$sth->execute($biblionumber);
my $timestamp = $sth->fetchrow_array . 'Z';
@ -86,7 +94,7 @@ foreach my $index ( 0 .. NUMBER_OF_MARC_RECORDS - 1 ) {
metadata => {
'oai_dc:dc' => {
'dc:title' => "Title $index",
'dc:language' => {},
'dc:language' => "lng",
'dc:type' => {},
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xmlns:oai_dc' => 'http://www.openarchives.org/OAI/2.0/oai_dc/',