From: tla Date: Sun, 7 Dec 2014 19:58:18 +0000 (+0100) Subject: release current version of persistence module X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=148c2eb104dcdf73c6808e551e8fd938d46beb77;p=scpubgit%2Fstemmatology.git release current version of persistence module --- diff --git a/persistence/CHANGES b/persistence/CHANGES index eb28bdb..e1598ed 100644 --- a/persistence/CHANGES +++ b/persistence/CHANGES @@ -1,3 +1,8 @@ +*** Version 1.2, 07/12/2014 + +- Workaround for a UTF-8 encoding bug when using MySQL as the storage backend + + *** Version 1.1, 23/09/2012 commit 3f54eb870cf3bae380898dbe0c21ec7a22a2c8eb diff --git a/persistence/Makefile.PL b/persistence/Makefile.PL index 76c0391..a3475a9 100644 --- a/persistence/Makefile.PL +++ b/persistence/Makefile.PL @@ -23,4 +23,5 @@ requires( 'YAML::XS' ); requires( 'namespace::clean' ); build_requires( 'Test::Warn' ); build_requires( 'Test::Memory::Cycle' ); +build_requires( 'Test::More::UTF8' ); &WriteAll; diff --git a/persistence/lib/Text/Tradition/Directory.pm b/persistence/lib/Text/Tradition/Directory.pm index 3afc469..ec8462e 100644 --- a/persistence/lib/Text/Tradition/Directory.pm +++ b/persistence/lib/Text/Tradition/Directory.pm @@ -20,7 +20,7 @@ use Text::Tradition::TypeMap::Entry; extends 'KiokuX::Model'; use vars qw/ $VERSION /; -$VERSION = "1.1"; +$VERSION = "1.2"; =head1 NAME @@ -185,25 +185,35 @@ ok( $nt->$_isa('Text::Tradition'), "Made new tradition" ); is( $e->ident, 'database error', "Got exception trying to fetch stemma directly" ); like( $e->message, qr/not a Text::Tradition/, "Exception has correct message" ); } - try { - $f->delete( $sid ); - } catch( Text::Tradition::Error $e ) { - is( $e->ident, 'database error', "Got exception trying to delete stemma directly" ); - like( $e->message, qr/Cannot directly delete non-Tradition object/, - "Exception has correct message" ); + if( $ENV{TEST_DELETION} ) { + try { + $f->delete( $sid ); + } catch( Text::Tradition::Error $e ) { + is( $e->ident, 'database error', "Got exception trying to delete stemma directly" ); + like( $e->message, qr/Cannot directly delete non-Tradition object/, + "Exception has correct message" ); + } } } - $f->delete( $uuid ); - ok( !$f->exists( $uuid ), "Object is deleted from DB" ); - ok( !$f->exists( $sid ), "Object stemma also deleted from DB" ) if $stemma_enabled; - is( scalar $f->traditionlist, 1, "Object is deleted from index" ); + SKIP: { + skip "Set TEST_DELETION in env to test DB deletion functionality", 3 + unless $ENV{TEST_DELETION}; + $f->delete( $uuid ); + ok( !$f->exists( $uuid ), "Object is deleted from DB" ); + ok( !$f->exists( $sid ), "Object stemma also deleted from DB" ) if $stemma_enabled; + is( scalar $f->traditionlist, 1, "Object is deleted from index" ); + } } { my $g = Text::Tradition::Directory->new( 'dsn' => $dsn ); my $scope = $g->new_scope; - is( scalar $g->traditionlist, 1, "Now one object in new directory index" ); + SKIP: { + skip "Set TEST_DELETION in env to test DB deletion functionality", 1 + unless $ENV{TEST_DELETION}; + is( scalar $g->traditionlist, 1, "Now one object in new directory index" ); + } my $ntobj = $g->tradition( 'CX' ); my @w1 = sort { $a->sigil cmp $b->sigil } $ntobj->witnesses; my @w2 = sort{ $a->sigil cmp $b->sigil } $nt->witnesses; diff --git a/persistence/t/text_tradition_directory.t b/persistence/t/text_tradition_directory.t index bbf8ce0..e99c82b 100644 --- a/persistence/t/text_tradition_directory.t +++ b/persistence/t/text_tradition_directory.t @@ -86,25 +86,35 @@ ok( $nt->$_isa('Text::Tradition'), "Made new tradition" ); is( $e->ident, 'database error', "Got exception trying to fetch stemma directly" ); like( $e->message, qr/not a Text::Tradition/, "Exception has correct message" ); } - try { - $f->delete( $sid ); - } catch( Text::Tradition::Error $e ) { - is( $e->ident, 'database error', "Got exception trying to delete stemma directly" ); - like( $e->message, qr/Cannot directly delete non-Tradition object/, - "Exception has correct message" ); + if( $ENV{TEST_DELETION} ) { + try { + $f->delete( $sid ); + } catch( Text::Tradition::Error $e ) { + is( $e->ident, 'database error', "Got exception trying to delete stemma directly" ); + like( $e->message, qr/Cannot directly delete non-Tradition object/, + "Exception has correct message" ); + } } } - $f->delete( $uuid ); - ok( !$f->exists( $uuid ), "Object is deleted from DB" ); - ok( !$f->exists( $sid ), "Object stemma also deleted from DB" ) if $stemma_enabled; - is( scalar $f->traditionlist, 1, "Object is deleted from index" ); + SKIP: { + skip "Set TEST_DELETION in env to test DB deletion functionality", 3 + unless $ENV{TEST_DELETION}; + $f->delete( $uuid ); + ok( !$f->exists( $uuid ), "Object is deleted from DB" ); + ok( !$f->exists( $sid ), "Object stemma also deleted from DB" ) if $stemma_enabled; + is( scalar $f->traditionlist, 1, "Object is deleted from index" ); + } } { my $g = Text::Tradition::Directory->new( 'dsn' => $dsn ); my $scope = $g->new_scope; - is( scalar $g->traditionlist, 1, "Now one object in new directory index" ); + SKIP: { + skip "Set TEST_DELETION in env to test DB deletion functionality", 1 + unless $ENV{TEST_DELETION}; + is( scalar $g->traditionlist, 1, "Now one object in new directory index" ); + } my $ntobj = $g->tradition( 'CX' ); my @w1 = sort { $a->sigil cmp $b->sigil } $ntobj->witnesses; my @w2 = sort{ $a->sigil cmp $b->sigil } $nt->witnesses;