Lines 29-35
use MARC::Record;
Link Here
|
29 |
use Try::Tiny; |
29 |
use Try::Tiny; |
30 |
use List::Util qw( any ); |
30 |
use List::Util qw( any ); |
31 |
|
31 |
|
32 |
use C4::AuthoritiesMarc; |
32 |
use C4::AuthoritiesMarc qw( AddAuthority ); |
33 |
|
33 |
|
34 |
use Koha::SearchEngine::Elasticsearch; |
34 |
use Koha::SearchEngine::Elasticsearch; |
35 |
use Koha::SearchEngine::Elasticsearch::Search; |
35 |
use Koha::SearchEngine::Elasticsearch::Search; |
Lines 98-113
subtest '_read_configuration() tests' => sub {
Link Here
|
98 |
is( $configuration->{cxn_pool}, 'Static', 'cxn_pool configuration set correctly to Static if not specified' ); |
98 |
is( $configuration->{cxn_pool}, 'Static', 'cxn_pool configuration set correctly to Static if not specified' ); |
99 |
is_deeply( $configuration->{nodes}, \@servers , 'Server configuration parsed correctly' ); |
99 |
is_deeply( $configuration->{nodes}, \@servers , 'Server configuration parsed correctly' ); |
100 |
|
100 |
|
101 |
t::lib::Mocks::mock_config( 'elasticsearch', { server => \@servers, index_name => 'index', cxn_pool => 'Fluid' } ); |
101 |
t::lib::Mocks::mock_config( 'elasticsearch', { server => \@servers, index_name => 'index', cxn_pool => 'Sniff' } ); |
102 |
|
102 |
|
103 |
$configuration = Koha::SearchEngine::Elasticsearch::_read_configuration; |
103 |
$configuration = Koha::SearchEngine::Elasticsearch::_read_configuration; |
104 |
is( $configuration->{cxn_pool}, 'Fluid', 'cxn_pool configuration parsed correctly' ); |
104 |
is( $configuration->{cxn_pool}, 'Sniff', 'cxn_pool configuration parsed correctly' ); |
105 |
isnt( defined $configuration->{trace_to}, 'trace_to is not defined if not set' ); |
105 |
isnt( defined $configuration->{trace_to}, 'trace_to is not defined if not set' ); |
106 |
|
106 |
|
107 |
my $params = Koha::SearchEngine::Elasticsearch::get_elasticsearch_params; |
107 |
my $params = Koha::SearchEngine::Elasticsearch::get_elasticsearch_params; |
108 |
is_deeply( $configuration->{nodes}, \@servers , 'get_elasticsearch_params is just a wrapper for _read_configuration' ); |
108 |
is_deeply( $configuration->{nodes}, \@servers , 'get_elasticsearch_params is just a wrapper for _read_configuration' ); |
109 |
|
109 |
|
110 |
t::lib::Mocks::mock_config( 'elasticsearch', { server => \@servers, index_name => 'index', cxn_pool => 'Fluid', trace_to => 'Stderr' } ); |
110 |
t::lib::Mocks::mock_config( 'elasticsearch', { server => \@servers, index_name => 'index', cxn_pool => 'Sniff', trace_to => 'Stderr' } ); |
111 |
|
111 |
|
112 |
$configuration = Koha::SearchEngine::Elasticsearch::_read_configuration; |
112 |
$configuration = Koha::SearchEngine::Elasticsearch::_read_configuration; |
113 |
is( $configuration->{trace_to}, 'Stderr', 'trace_to configuration parsed correctly' ); |
113 |
is( $configuration->{trace_to}, 'Stderr', 'trace_to configuration parsed correctly' ); |
Lines 858-863
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents with Inclu
Link Here
|
858 |
|
858 |
|
859 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
859 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
860 |
t::lib::Mocks::mock_preference('IncludeSeeFromInSearches', '1'); |
860 |
t::lib::Mocks::mock_preference('IncludeSeeFromInSearches', '1'); |
|
|
861 |
my $dbh = C4::Context->dbh; |
861 |
|
862 |
|
862 |
my $builder = t::lib::TestBuilder->new; |
863 |
my $builder = t::lib::TestBuilder->new; |
863 |
my $auth_type = $builder->build_object({ |
864 |
my $auth_type = $builder->build_object({ |
Lines 871-877
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents with Inclu
Link Here
|
871 |
MARC::Field->new(150, '', '', a => 'Foo'), |
872 |
MARC::Field->new(150, '', '', a => 'Foo'), |
872 |
MARC::Field->new(450, '', '', a => 'Bar'), |
873 |
MARC::Field->new(450, '', '', a => 'Bar'), |
873 |
); |
874 |
); |
874 |
my $authid = AddAuthority($authority_record, undef, $auth_type->authtypecode); |
875 |
$dbh->do( "INSERT INTO auth_header (datecreated,marcxml) values (NOW(),?)", undef, ($authority_record->as_xml_record('MARC21') ) ); |
|
|
876 |
my $authid = $dbh->last_insert_id( undef, undef, 'auth_header', 'authid' ); |
875 |
|
877 |
|
876 |
my @mappings = ( |
878 |
my @mappings = ( |
877 |
{ |
879 |
{ |
878 |
- |
|
|