diff --git a/Gemfile.lock b/Gemfile.lock index 1cd4821d..d901a1f1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -53,7 +53,7 @@ GIT GIT remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git - revision: 189f5898e1e2422a647f3937495c3ea1c9894350 + revision: 0b0414dc1af8ddac39642ce23be5970de5acc00c branch: feature/migrate-to-virtuoso specs: ontologies_linked_data (0.0.1) diff --git a/config/environments/test.rb b/config/environments/test.rb index 4ef0f3cd..a2387c32 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -12,12 +12,14 @@ SOLR_PROP_SEARCH_URL = ENV.include?("SOLR_PROP_SEARCH_URL") ? ENV["SOLR_PROP_SEARCH_URL"] : "http://localhost:8984/solr/prop_search_core1" MGREP_HOST = ENV.include?("MGREP_HOST") ? ENV["MGREP_HOST"] : "localhost" MGREP_PORT = ENV.include?("MGREP_PORT") ? ENV["MGREP_PORT"] : 55556 +GOO_SLICES = ENV["GOO_SLICES"] || 500 begin # For prefLabel extract main_lang first, or anything if no main found. # For other properties only properties with a lang that is included in main_lang are used Goo.main_languages = ['en'] Goo.use_cache = false + Goo.slice_loading_size = GOO_SLICES.to_i rescue NoMethodError puts "(CNFG) >> Goo.main_lang not available" end diff --git a/test/controllers/test_annotator_controller.rb b/test/controllers/test_annotator_controller.rb index ffa65a97..0a70bee9 100644 --- a/test/controllers/test_annotator_controller.rb +++ b/test/controllers/test_annotator_controller.rb @@ -16,7 +16,12 @@ def self.before_suite end LinkedData::SampleData::Ontology.delete_ontologies_and_submissions - @@ontologies = LinkedData::SampleData::Ontology.sample_owl_ontologies + @@ontologies = LinkedData::SampleData::Ontology.sample_owl_ontologies(process_submission: true, + process_options: { + process_rdf: true, + extract_metadata: false, + index_search: true + }) annotator = Annotator::Models::NcboAnnotator.new annotator.init_redis_for_tests() annotator.create_term_cache_from_ontologies(@@ontologies, false) @@ -348,7 +353,8 @@ def self.mapping_test_set classes = [] class_id = terms_a[i] ont_acr = onts_a[i] - sub = LinkedData::Models::Ontology.find(ont_acr).first.latest_submission + sub = LinkedData::Models::Ontology.find(ont_acr).first.latest_submission(status: :any) + binding.pry if sub.nil? sub.bring(ontology: [:acronym]) c = LinkedData::Models::Class.find(RDF::URI.new(class_id)) .in(sub) @@ -356,7 +362,7 @@ def self.mapping_test_set classes << c class_id = terms_b[i] ont_acr = onts_b[i] - sub = LinkedData::Models::Ontology.find(ont_acr).first.latest_submission + sub = LinkedData::Models::Ontology.find(ont_acr).first.latest_submission(status: :any) sub.bring(ontology: [:acronym]) c = LinkedData::Models::Class.find(RDF::URI.new(class_id)) .in(sub) diff --git a/test/controllers/test_batch_controller.rb b/test/controllers/test_batch_controller.rb index 55d9cee9..d1e9d144 100644 --- a/test/controllers/test_batch_controller.rb +++ b/test/controllers/test_batch_controller.rb @@ -2,8 +2,7 @@ class TestBatchController < TestCase def self.before_suite - LinkedData::SampleData::Ontology.delete_ontologies_and_submissions - @@ontologies = LinkedData::SampleData::Ontology.sample_owl_ontologies + @@ontologies = LinkedData::SampleData::Ontology.sample_owl_ontologies(process_submission: true) end def test_class_batch_one_ontology diff --git a/test/controllers/test_classes_controller.rb b/test/controllers/test_classes_controller.rb index a918ece0..42ccf29b 100644 --- a/test/controllers/test_classes_controller.rb +++ b/test/controllers/test_classes_controller.rb @@ -7,7 +7,9 @@ def self.before_suite submission_count: 3, submissions_to_process: [1, 2], process_submission: true, - random_submission_count: false} + random_submission_count: false, + process_options: {process_rdf: true, extract_metadata: false} + } return LinkedData::SampleData::Ontology.create_ontologies_and_submissions(options) end diff --git a/test/controllers/test_collections_controller.rb b/test/controllers/test_collections_controller.rb index 2b9c9692..b7bc6f1b 100644 --- a/test/controllers/test_collections_controller.rb +++ b/test/controllers/test_collections_controller.rb @@ -5,6 +5,7 @@ class TestCollectionsController < TestCase def self.before_suite LinkedData::SampleData::Ontology.create_ontologies_and_submissions({ process_submission: true, + process_options: {process_rdf: true, extract_metadata: false}, acronym: 'INRAETHES', name: 'INRAETHES', file_path: './test/data/ontology_files/thesaurusINRAE_nouv_structure.rdf', diff --git a/test/controllers/test_external_mappings_controller.rb b/test/controllers/test_external_mappings_controller.rb index 6cfabf32..a194bcf7 100644 --- a/test/controllers/test_external_mappings_controller.rb +++ b/test/controllers/test_external_mappings_controller.rb @@ -14,6 +14,7 @@ def self.before_suite end LinkedData::SampleData::Ontology.create_ontologies_and_submissions({ process_submission: true, + process_options: {process_rdf: true, extract_metadata: false}, acronym: "BRO-TEST-MAP", name: "BRO-TEST-MAP", file_path: "./test/data/ontology_files/BRO_v3.2.owl", @@ -22,6 +23,7 @@ def self.before_suite }) LinkedData::SampleData::Ontology.create_ontologies_and_submissions({ process_submission: true, + process_options: {process_rdf: true, extract_metadata: false}, acronym: "CNO-TEST-MAP", name: "CNO-TEST-MAP", file_path: "./test/data/ontology_files/CNO_05.owl", @@ -30,6 +32,7 @@ def self.before_suite }) LinkedData::SampleData::Ontology.create_ontologies_and_submissions({ process_submission: true, + process_options: {process_rdf: true, extract_metadata: false}, acronym: "FAKE-TEST-MAP", name: "FAKE-TEST-MAP", file_path: "./test/data/ontology_files/fake_for_mappings.owl", diff --git a/test/controllers/test_instances_controller.rb b/test/controllers/test_instances_controller.rb index 9560c0b0..e4b0460b 100644 --- a/test/controllers/test_instances_controller.rb +++ b/test/controllers/test_instances_controller.rb @@ -5,6 +5,7 @@ class TestInstancesController < TestCase def self.before_suite LinkedData::SampleData::Ontology.create_ontologies_and_submissions({ process_submission: true, + process_options: { process_rdf: true, extract_metadata: false, generate_missing_labels: false}, acronym: 'XCT-TEST-INST', name: 'XCT-TEST-INST', file_path: './test/data/ontology_files/XCTontologyvtemp2.owl', @@ -13,9 +14,6 @@ def self.before_suite }) end - def self.after_suite - LinkedData::SampleData::Ontology.delete_ontologies_and_submissions - end def test_first_default_page ont = Ontology.find('XCT-TEST-INST-0').include(:acronym).first @@ -52,6 +50,7 @@ def test_all_instance_pages assert last_response.ok? instance_count = instance_count + response['collection'].size end while response['nextPage'] + assert_equal 714, instance_count # Next page should have no results. diff --git a/test/controllers/test_mappings_controller.rb b/test/controllers/test_mappings_controller.rb index 52c3975d..34ca9de3 100644 --- a/test/controllers/test_mappings_controller.rb +++ b/test/controllers/test_mappings_controller.rb @@ -15,6 +15,7 @@ def self.before_suite end LinkedData::SampleData::Ontology.create_ontologies_and_submissions({ process_submission: true, + process_options: { process_rdf: true, extract_metadata: false}, acronym: "BRO-TEST-MAP", name: "BRO-TEST-MAP", file_path: "./test/data/ontology_files/BRO_v3.2.owl", @@ -23,6 +24,7 @@ def self.before_suite }) LinkedData::SampleData::Ontology.create_ontologies_and_submissions({ process_submission: true, + process_options: { process_rdf: true, extract_metadata: false}, acronym: "CNO-TEST-MAP", name: "CNO-TEST-MAP", file_path: "./test/data/ontology_files/CNO_05.owl", @@ -31,6 +33,7 @@ def self.before_suite }) LinkedData::SampleData::Ontology.create_ontologies_and_submissions({ process_submission: true, + process_options: { process_rdf: true, extract_metadata: false}, acronym: "FAKE-TEST-MAP", name: "FAKE-TEST-MAP", file_path: "./test/data/ontology_files/fake_for_mappings.owl", diff --git a/test/helpers/test_http_cache_helper.rb b/test/helpers/test_http_cache_helper.rb index 944198a6..5268066a 100644 --- a/test/helpers/test_http_cache_helper.rb +++ b/test/helpers/test_http_cache_helper.rb @@ -4,7 +4,6 @@ class TestHTTPCacheHelper < TestCaseHelpers def self.before_suite raise Exception, "Redis is unavailable, caching will not function" if LinkedData::HTTPCache.redis.ping.nil? - self.new("before_suite").delete_ontologies_and_submissions ontologies = self.new("before_suite")._ontologies @@ontology = ontologies.shift @@ontology_alt = ontologies.shift diff --git a/test/test_case.rb b/test/test_case.rb index 3d9eabe5..c1f2cc45 100644 --- a/test/test_case.rb +++ b/test/test_case.rb @@ -149,6 +149,9 @@ def app # @option options [TrueClass, FalseClass] :random_submission_count Use a random number of submissions between 1 and :submission_count # @option options [TrueClass, FalseClass] :process_submission Parse the test ontology file def create_ontologies_and_submissions(options = {}) + if options[:process_submission] && options[:process_options].nil? + options[:process_options] = { process_rdf: true, extract_metadata: false, generate_missing_labels: false } + end LinkedData::SampleData::Ontology.create_ontologies_and_submissions(options) end