Bugzilla – Attachment 58248 Details for
Bug 15108
OAI-PMH provider improvements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15108: [QA Follow-up] Remove truncate
Bug-15108-QA-Follow-up-Remove-truncate.patch (text/plain), 8.09 KB, created by
Marcel de Rooy
on 2016-12-16 11:03:08 UTC
(
hide
)
Description:
Bug 15108: [QA Follow-up] Remove truncate
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2016-12-16 11:03:08 UTC
Size:
8.09 KB
patch
obsolete
>From fbcb17eaf38f16b17b37f72f4bc6280ce4057286 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 9 Dec 2016 14:14:49 +0100 >Subject: [PATCH] Bug 15108: [QA Follow-up] Remove truncate >Content-Type: text/plain; charset=utf-8 > >Truncate operations cause an implicit commit, and so cannot be rolled back. >So we need to replace it by a DELETE and adjust the code so that it >does not assume numbering biblionumbers from 1, etc. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/OAI/Server.t | 53 ++++++++++++++++++++++----------------------- > 1 file changed, 26 insertions(+), 27 deletions(-) > >diff --git a/t/db_dependent/OAI/Server.t b/t/db_dependent/OAI/Server.t >index 8a177c0..cd643b7 100644 >--- a/t/db_dependent/OAI/Server.t >+++ b/t/db_dependent/OAI/Server.t >@@ -56,11 +56,11 @@ my $schema = Koha::Database->schema; > $schema->storage->txn_begin; > my $dbh = C4::Context->dbh; > >-$dbh->do('SET FOREIGN_KEY_CHECKS = 0'); > $dbh->do("SET time_zone='+00:00'"); >-$dbh->do('TRUNCATE biblio'); >-$dbh->do('TRUNCATE biblioitems'); >-$dbh->do('TRUNCATE issues'); >+$dbh->do('DELETE FROM biblio'); >+$dbh->do('DELETE FROM deletedbiblio'); >+$dbh->do('DELETE FROM deletedbiblioitems'); >+$dbh->do('DELETE FROM deleteditems'); > > my $date_added = DateTime->now() . 'Z'; > my $date_to = substr($date_added, 0, 10) . 'T23:59:59Z'; >@@ -68,24 +68,24 @@ my (@header, @marcxml, @oaidc); > my $sth = $dbh->prepare('SELECT timestamp FROM biblioitems WHERE biblionumber=?'); > > # Add 10 biblio records >-foreach( 1..10 ) { >+foreach my $index ( 0..9 ) { > my $record = MARC::Record->new(); >- $record->append_fields( MARC::Field->new('245', '', '', 'a' => "Title $_" ) ); >+ $record->append_fields( MARC::Field->new('245', '', '', 'a' => "Title $index" ) ); > my ($biblionumber) = AddBiblio($record, ''); > $sth->execute($biblionumber); > my $timestamp = $sth->fetchrow_array . 'Z'; > $timestamp =~ s/ /T/; > $record = GetMarcBiblio($biblionumber); > $record = XMLin($record->as_xml_record); >- $header[$biblionumber] = { datestamp => $timestamp, identifier => "TEST:$biblionumber" }; >+ push @header, { datestamp => $timestamp, identifier => "TEST:$biblionumber" }; > delete $record->{$_} for (('xmlns','xmlns:xsi','xsi:schemaLocation')); >- $oaidc[$biblionumber] = { >- header => $header[$biblionumber], >+ push @oaidc, { >+ header => $header[$index], > metadata => { > 'oai_dc:dcCollection' => { > 'oai_dc:dc' => { > 'dc:title' => { >- 'content' => "Title $biblionumber", >+ 'content' => "Title $index", > 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/' > }, > 'dc:language' => { >@@ -101,11 +101,11 @@ foreach( 1..10 ) { > }, > }, > }; >- $marcxml[$biblionumber] = { >- header => $header[$biblionumber], >+ push @marcxml, { >+ header => $header[$index], > metadata => { > collection => { >- record => $record, >+ record => $record, > "xmlns" => "http://www.loc.gov/MARC21/slim", > "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", > "xsi:schemaLocation" => "http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd", >@@ -188,10 +188,9 @@ test_query('ListIdentifiers without metadataPrefix', {verb => 'ListIdentifiers'} > }, > }); > >- > test_query('ListIdentifiers', {verb => 'ListIdentifiers', metadataPrefix => 'marcxml'}, { > ListIdentifiers => { >- header => [ @header[1..3] ], >+ header => [ @header[0..2] ], > resumptionToken => { > content => "marcxml/3/1970-01-01T00:00:00Z/$date_to//0", > cursor => 3, >@@ -201,7 +200,7 @@ test_query('ListIdentifiers', {verb => 'ListIdentifiers', metadataPrefix => 'mar > > test_query('ListIdentifiers', {verb => 'ListIdentifiers', metadataPrefix => 'marcxml'}, { > ListIdentifiers => { >- header => [ @header[1..3] ], >+ header => [ @header[0..2] ], > resumptionToken => { > content => "marcxml/3/1970-01-01T00:00:00Z/$date_to//0", > cursor => 3, >@@ -214,7 +213,7 @@ test_query( > { verb => 'ListIdentifiers', resumptionToken => "marcxml/3/1970-01-01T00:00:00Z/$date_to//0" }, > { > ListIdentifiers => { >- header => [ @header[4..6] ], >+ header => [ @header[3..5] ], > resumptionToken => { > content => "marcxml/6/1970-01-01T00:00:00Z/$date_to//0", > cursor => 6, >@@ -229,7 +228,7 @@ test_query( > { verb => 'ListIdentifiers', resumptionToken => "marcxml/6/1970-01-01T00:00:00Z/$date_to//0" }, > { > ListIdentifiers => { >- header => [ @header[7..9] ], >+ header => [ @header[6..8] ], > resumptionToken => { > content => "marcxml/9/1970-01-01T00:00:00Z/$date_to//0", > cursor => 9, >@@ -244,7 +243,7 @@ test_query( > { verb => 'ListIdentifiers', resumptionToken => "marcxml/9/1970-01-01T00:00:00Z/$date_to//0" }, > { > ListIdentifiers => { >- header => $header[10], >+ header => $header[9], > }, > > }, >@@ -259,7 +258,7 @@ test_query('ListRecords marcxml without metadataPrefix', {verb => 'ListRecords'} > > test_query('ListRecords marcxml', {verb => 'ListRecords', metadataPrefix => 'marcxml'}, { > ListRecords => { >- record => [ @marcxml[1..3] ], >+ record => [ @marcxml[0..2] ], > resumptionToken => { > content => "marcxml/3/1970-01-01T00:00:00Z/$date_to//0", > cursor => 3, >@@ -271,7 +270,7 @@ test_query( > 'ListRecords marcxml with resumptionToken 1', > { verb => 'ListRecords', resumptionToken => "marcxml/3/1970-01-01T00:00:00Z/$date_to//0" }, > { ListRecords => { >- record => [ @marcxml[4..6] ], >+ record => [ @marcxml[3..5] ], > resumptionToken => { > content => "marcxml/6/1970-01-01T00:00:00Z/$date_to//0", > cursor => 6, >@@ -283,7 +282,7 @@ test_query( > 'ListRecords marcxml with resumptionToken 2', > { verb => 'ListRecords', resumptionToken => "marcxml/6/1970-01-01T00:00:00Z/$date_to//0" }, > { ListRecords => { >- record => [ @marcxml[7..9] ], >+ record => [ @marcxml[6..8] ], > resumptionToken => { > content => "marcxml/9/1970-01-01T00:00:00Z/$date_to//0", > cursor => 9, >@@ -296,13 +295,13 @@ test_query( > 'ListRecords marcxml with resumptionToken 3, response without resumption', > { verb => 'ListRecords', resumptionToken => "marcxml/9/1970-01-01T00:00:00Z/$date_to//0" }, > { ListRecords => { >- record => $marcxml[10], >+ record => $marcxml[9], > }, > }); > > test_query('ListRecords oai_dc', {verb => 'ListRecords', metadataPrefix => 'oai_dc'}, { > ListRecords => { >- record => [ @oaidc[1..3] ], >+ record => [ @oaidc[0..2] ], > resumptionToken => { > content => "oai_dc/3/1970-01-01T00:00:00Z/$date_to//0", > cursor => 3, >@@ -314,7 +313,7 @@ test_query( > 'ListRecords oai_dc with resumptionToken 1', > { verb => 'ListRecords', resumptionToken => "oai_dc/3/1970-01-01T00:00:00Z/$date_to//0" }, > { ListRecords => { >- record => [ @oaidc[4..6] ], >+ record => [ @oaidc[3..5] ], > resumptionToken => { > content => "oai_dc/6/1970-01-01T00:00:00Z/$date_to//0", > cursor => 6, >@@ -326,7 +325,7 @@ test_query( > 'ListRecords oai_dc with resumptionToken 2', > { verb => 'ListRecords', resumptionToken => "oai_dc/6/1970-01-01T00:00:00Z/$date_to//0" }, > { ListRecords => { >- record => [ @oaidc[7..9] ], >+ record => [ @oaidc[6..8] ], > resumptionToken => { > content => "oai_dc/9/1970-01-01T00:00:00Z/$date_to//0", > cursor => 9, >@@ -339,7 +338,7 @@ test_query( > 'ListRecords oai_dc with resumptionToken 3, response without resumption', > { verb => 'ListRecords', resumptionToken => "oai_dc/9/1970-01-01T00:00:00Z/$date_to//0" }, > { ListRecords => { >- record => $oaidc[10], >+ record => $oaidc[9], > }, > }); > >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15108
:
44317
|
44318
|
51962
|
52416
|
52422
|
52423
|
53853
|
53854
|
56813
|
56844
|
58058
|
58059
|
58060
|
58061
|
58062
|
58063
|
58064
|
58065
|
58072
|
58080
|
58245
|
58246
|
58247
|
58248
|
58249
|
58250
|
58251
|
60260
|
60331
|
60608
|
60835
|
60836
|
63172
|
63173
|
63174