| 1 | package Test::Attean::MutableTimeCacheableQuadStore; | ||
| 2 | |||
| 3 | 1 | ▶ | use v5.14; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use Test::Roo::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use Test::Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | ▶ | use Attean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 1 | ▶ | use Attean::RDF; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 1 | requires 'create_store'; # create_store( quads => \@quads ) | |
| 11 | 1 | with 'Test::Attean::StoreCleanup'; | |
| 12 | 1 | with 'Test::Attean::TimeCacheableQuadStore'; | |
| 13 | |||
| 14 | 0 | ▶ | sub caching_sleep_time { |
|
Subroutine
caching_sleep_time: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 15 | 0 | return 30; | |
| 16 | } | ||
| 17 | |||
| 18 | 1 | ▶ | test 'mutable timecacheablequadstore' => sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 19 | 1 | my $self = shift; | |
| 20 | 1 | my $q1 = quad(iri('s'), iri('p'), iri('o'), iri('g')); | |
| 21 | 1 | my $q2 = quad(iri('x'), iri('y'), iri('z'), iri('g')); | |
| 22 | 1 | my $store = $self->create_store(quads => [$q1, $q2]); | |
| 23 | 1 | my $start = $store->mtime_for_quads(); | |
| 24 | 1 | my $s = $self->caching_sleep_time; | |
| 25 | 1 | note("Sleeping for $s seconds"); | |
| 26 | 1 | sleep($s); | |
| 27 | 1 | $store->remove_quad($q1); | |
| 28 | 1 | my $end = $store->mtime_for_quads(); | |
| 29 | 1 | my $diff = abs($end - $start); | |
| 30 | 1 | isnt($start, $end, "mtime changed after update (by $diff seconds)"); | |
| 31 | 1 | $self->cleanup_store($store); | |
| 32 | 1 | }; | |
| 33 | |||
| 34 | 1 | 1; | |