From e09834f3aa9d0776acbce2673341f63228bc2a8e Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Thu, 14 Apr 2016 20:23:13 +0000 Subject: [PATCH] Bug 12478 Shifting tests and adding copyright headers Signed-off-by: Nick Clemens Signed-off-by: Jesse Weaver Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall Signed-off-by: Brendan Gallagher --- t/Koha_ElasticSearch.t | 23 --------- t/Koha_ElasticSearch_Indexer.t | 51 ------------------- t/Koha_SearchEngine_Elasticsearch_Search.t | 39 --------------- t/db_dependent/Koha_ElasticSearch.t | 23 +++++++++ t/db_dependent/Koha_ElasticSearch_Indexer.t | 52 ++++++++++++++++++++ .../Koha_SearchEngine_Elasticsearch_Search.t | 38 ++++++++++++++ 6 files changed, 113 insertions(+), 113 deletions(-) delete mode 100644 t/Koha_ElasticSearch.t delete mode 100644 t/Koha_ElasticSearch_Indexer.t delete mode 100644 t/Koha_SearchEngine_Elasticsearch_Search.t create mode 100644 t/db_dependent/Koha_ElasticSearch.t create mode 100644 t/db_dependent/Koha_ElasticSearch_Indexer.t create mode 100644 t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t diff --git a/t/Koha_ElasticSearch.t b/t/Koha_ElasticSearch.t deleted file mode 100644 index 8888f2c..0000000 --- a/t/Koha_ElasticSearch.t +++ /dev/null @@ -1,23 +0,0 @@ -# -#=============================================================================== -# -# FILE: Koha_ElasticSearch.t -# -# DESCRIPTION: -# -# FILES: --- -# BUGS: --- -# NOTES: --- -# AUTHOR: Chris Cormack (rangi), chrisc@catalyst.net.nz -# ORGANIZATION: Koha Development Team -# VERSION: 1.0 -# CREATED: 09/12/13 08:56:44 -# REVISION: --- -#=============================================================================== - -use strict; -use warnings; - -use Test::More tests => 1; # last test to print - -use_ok('Koha::ElasticSearch'); diff --git a/t/Koha_ElasticSearch_Indexer.t b/t/Koha_ElasticSearch_Indexer.t deleted file mode 100644 index d04a81f..0000000 --- a/t/Koha_ElasticSearch_Indexer.t +++ /dev/null @@ -1,51 +0,0 @@ -# -#=============================================================================== -# -# FILE: Koha_ElasticSearch_Indexer.t -# -# DESCRIPTION: -# -# FILES: --- -# BUGS: --- -# NOTES: --- -# AUTHOR: Chris Cormack (rangi), chrisc@catalyst.net.nz -# ORGANIZATION: Koha Development Team -# VERSION: 1.0 -# CREATED: 09/12/13 08:57:25 -# REVISION: --- -#=============================================================================== - -use strict; -use warnings; - -use Test::More tests => 5; # last test to print -use MARC::Record; - -use_ok('Koha::ElasticSearch::Indexer'); - -my $indexer; -ok( - $indexer = Koha::ElasticSearch::Indexer->new( - { - 'nodes' => ['localhost:9200'], - 'index' => 'mydb' - } - ), - 'Creating new indexer object' -); - -my $marc_record = MARC::Record->new(); -my $field = MARC::Field->new( '001', '1234567' ); -$marc_record->append_fields($field); -$field = MARC::Field->new( '020', '', '', 'a' => '1234567890123' ); -$marc_record->append_fields($field); -$field = MARC::Field->new( '245', '', '', 'a' => 'Title' ); -$marc_record->append_fields($field); - -my $records = [$marc_record]; -ok( my $converted = $indexer->_convert_marc_to_json($records), - 'Convert some records' ); - -is( $converted->count, 1, 'One converted record' ); - -ok( $indexer->update_index(undef,$records), 'Update Index' ); diff --git a/t/Koha_SearchEngine_Elasticsearch_Search.t b/t/Koha_SearchEngine_Elasticsearch_Search.t deleted file mode 100644 index 91c5da5..0000000 --- a/t/Koha_SearchEngine_Elasticsearch_Search.t +++ /dev/null @@ -1,39 +0,0 @@ -# -#=============================================================================== -# -# FILE: Koha_SearchEngine_Elasticsearch_Search.t -# -# DESCRIPTION: -# -# FILES: --- -# BUGS: --- -# NOTES: --- -# AUTHOR: Chris Cormack (rangi), chrisc@catalyst.net.nz -# ORGANIZATION: Koha Development Team -# VERSION: 1.0 -# CREATED: 09/12/13 09:43:29 -# REVISION: --- -#=============================================================================== - -use strict; -use warnings; - -use Test::More tests => 5; # last test to print -use Koha::SearchEngine::Elasticsearch::QueryBuilder; - -my $builder = Koha::SearchEngine::Elasticsearch::QueryBuilder->new( { index => 'mydb' } ); - -use_ok('Koha::SearchEngine::Elasticsearch::Search'); - -ok( - my $searcher = Koha::SearchEngine::Elasticsearch::Search->new( - { 'nodes' => ['localhost:9200'], 'index' => 'mydb' } - ), - 'Creating a Koha::ElasticSearch::Search object' -); - -is( $searcher->index, 'mydb', 'Testing basic accessor' ); - -ok( my $query = $builder->build_query('easy'), 'Build a search query'); - -ok( my $results = $searcher->search( $query) , 'Do a search ' ); diff --git a/t/db_dependent/Koha_ElasticSearch.t b/t/db_dependent/Koha_ElasticSearch.t new file mode 100644 index 0000000..d9ea31f --- /dev/null +++ b/t/db_dependent/Koha_ElasticSearch.t @@ -0,0 +1,23 @@ +# Copyright 2015 Catalyst IT +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see + +use strict; +use warnings; + +use Test::More tests => 1; # last test to print + +use_ok('Koha::ElasticSearch'); diff --git a/t/db_dependent/Koha_ElasticSearch_Indexer.t b/t/db_dependent/Koha_ElasticSearch_Indexer.t new file mode 100644 index 0000000..80539e3 --- /dev/null +++ b/t/db_dependent/Koha_ElasticSearch_Indexer.t @@ -0,0 +1,52 @@ +# Copyright 2015 Catalyst IT +# +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use strict; +use warnings; + +use Test::More tests => 5; # last test to print +use MARC::Record; + +use_ok('Koha::ElasticSearch::Indexer'); + +my $indexer; +ok( + $indexer = Koha::ElasticSearch::Indexer->new( + { + 'nodes' => ['localhost:9200'], + 'index' => 'mydb' + } + ), + 'Creating new indexer object' +); + +my $marc_record = MARC::Record->new(); +my $field = MARC::Field->new( '001', '1234567' ); +$marc_record->append_fields($field); +$field = MARC::Field->new( '020', '', '', 'a' => '1234567890123' ); +$marc_record->append_fields($field); +$field = MARC::Field->new( '245', '', '', 'a' => 'Title' ); +$marc_record->append_fields($field); + +my $records = [$marc_record]; +ok( my $converted = $indexer->_convert_marc_to_json($records), + 'Convert some records' ); + +is( $converted->count, 1, 'One converted record' ); + +ok( $indexer->update_index(undef,$records), 'Update Index' ); diff --git a/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t b/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t new file mode 100644 index 0000000..6e6e2a4 --- /dev/null +++ b/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t @@ -0,0 +1,38 @@ +# Copyright 2015 Catalyst IT +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . +use strict; +use warnings; + +use Test::More tests => 5; # last test to print +use Koha::SearchEngine::Elasticsearch::QueryBuilder; + +my $builder = Koha::SearchEngine::Elasticsearch::QueryBuilder->new( { index => 'mydb' } ); + +use_ok('Koha::SearchEngine::Elasticsearch::Search'); + +ok( + my $searcher = Koha::SearchEngine::Elasticsearch::Search->new( + { 'nodes' => ['localhost:9200'], 'index' => 'mydb' } + ), + 'Creating a Koha::ElasticSearch::Search object' +); + +is( $searcher->index, 'mydb', 'Testing basic accessor' ); + +ok( my $query = $builder->build_query('easy'), 'Build a search query'); + +ok( my $results = $searcher->search( $query) , 'Do a search ' ); -- 1.7.2.5