krikri 0.12.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/krikri/activity.rb +34 -8
  3. data/lib/generators/krikri/templates/schema.xml +1 -0
  4. data/lib/generators/krikri/templates/solrconfig.xml +1 -0
  5. data/lib/krikri/async_uri_getter.rb +27 -0
  6. data/lib/krikri/engine.rb +19 -4
  7. data/lib/krikri/enricher.rb +3 -6
  8. data/lib/krikri/entity_behavior.rb +57 -11
  9. data/lib/krikri/entity_behaviors/aggregation_entity_behavior.rb +1 -1
  10. data/lib/krikri/entity_behaviors/original_record_entity_behavior.rb +1 -1
  11. data/lib/krikri/entity_consumer.rb +40 -17
  12. data/lib/krikri/indexer.rb +7 -7
  13. data/lib/krikri/mapper.rb +23 -14
  14. data/lib/krikri/search_index.rb +4 -0
  15. data/lib/krikri/software_agent.rb +8 -4
  16. data/lib/krikri/version.rb +1 -1
  17. data/spec/internal/Gemfile +3 -3
  18. data/spec/internal/Gemfile.lock +28 -28
  19. data/spec/internal/app/assets/javascripts/application.js +1 -1
  20. data/spec/internal/config/initializers/blacklight_initializer.rb +1 -1
  21. data/spec/internal/config/initializers/devise.rb +2 -2
  22. data/spec/internal/config/secrets.yml +2 -2
  23. data/spec/internal/db/development.sqlite3 +0 -0
  24. data/spec/internal/db/migrate/{20160304151204_devise_create_users.rb → 20160226160200_devise_create_users.rb} +0 -0
  25. data/spec/internal/db/migrate/{20160304151247_create_searches.blacklight.rb → 20160226160226_create_searches.blacklight.rb} +0 -0
  26. data/spec/internal/db/migrate/{20160304151248_create_bookmarks.blacklight.rb → 20160226160227_create_bookmarks.blacklight.rb} +0 -0
  27. data/spec/internal/db/migrate/{20160304151249_add_polymorphic_type_to_bookmarks.blacklight.rb → 20160226160228_add_polymorphic_type_to_bookmarks.blacklight.rb} +0 -0
  28. data/spec/internal/db/schema.rb +1 -1
  29. data/spec/internal/db/test.sqlite3 +0 -0
  30. data/spec/internal/log/development.log +92 -92
  31. data/spec/lib/krikri/async_uri_getter_spec.rb +31 -7
  32. data/spec/lib/krikri/entity_consumer_spec.rb +37 -7
  33. data/spec/lib/krikri/harvester_spec.rb +7 -3
  34. data/spec/lib/krikri/indexer_spec.rb +7 -4
  35. data/spec/lib/krikri/mapper_agent_spec.rb +10 -9
  36. data/spec/lib/krikri/search_index_spec.rb +3 -6
  37. data/spec/models/activity_spec.rb +32 -0
  38. data/spec/models/dpla/map/aggregation_spec.rb +40 -21
  39. data/spec/models/provider_spec.rb +2 -9
  40. data/spec/spec_helper.rb +1 -2
  41. data/spec/support/shared_contexts/indexed_item.rb +1 -3
  42. data/spec/support/shared_examples/software_agent.rb +1 -1
  43. metadata +11 -14
  44. data/lib/generators/krikri/templates/schema.xml +0 -767
  45. data/lib/generators/krikri/templates/solrconfig.xml +0 -160
  46. data/spec/internal/log/test.log +0 -8537
@@ -1,7 +1,7 @@
1
1
  PATH
2
- remote: /vagrant
2
+ remote: /Users/mark/Documents/Code/dpla/KriKri
3
3
  specs:
4
- krikri (0.12.0.pre.rc.1)
4
+ krikri (0.11.2)
5
5
  analysand (= 4.0.0)
6
6
  audumbla (~> 0.1)
7
7
  blacklight (~> 5.8.0)
@@ -26,17 +26,17 @@ PATH
26
26
  GEM
27
27
  remote: https://rubygems.org/
28
28
  specs:
29
- actionmailer (4.1.9)
30
- actionpack (= 4.1.9)
31
- actionview (= 4.1.9)
29
+ actionmailer (4.1.14.1)
30
+ actionpack (= 4.1.14.1)
31
+ actionview (= 4.1.14.1)
32
32
  mail (~> 2.5, >= 2.5.4)
33
- actionpack (4.1.9)
34
- actionview (= 4.1.9)
35
- activesupport (= 4.1.9)
33
+ actionpack (4.1.14.1)
34
+ actionview (= 4.1.14.1)
35
+ activesupport (= 4.1.14.1)
36
36
  rack (~> 1.5.2)
37
37
  rack-test (~> 0.6.2)
38
- actionview (4.1.9)
39
- activesupport (= 4.1.9)
38
+ actionview (4.1.14.1)
39
+ activesupport (= 4.1.14.1)
40
40
  builder (~> 3.1)
41
41
  erubis (~> 2.7.0)
42
42
  active-triples (0.6.1)
@@ -45,14 +45,14 @@ GEM
45
45
  deprecation (~> 0.1)
46
46
  linkeddata (~> 1.1)
47
47
  rdf (~> 1.1)
48
- activemodel (4.1.9)
49
- activesupport (= 4.1.9)
48
+ activemodel (4.1.14.1)
49
+ activesupport (= 4.1.14.1)
50
50
  builder (~> 3.1)
51
- activerecord (4.1.9)
52
- activemodel (= 4.1.9)
53
- activesupport (= 4.1.9)
51
+ activerecord (4.1.14.1)
52
+ activemodel (= 4.1.14.1)
53
+ activesupport (= 4.1.14.1)
54
54
  arel (~> 5.0.0)
55
- activesupport (4.1.9)
55
+ activesupport (4.1.14.1)
56
56
  i18n (~> 0.6, >= 0.6.9)
57
57
  json (~> 1.7, >= 1.7.7)
58
58
  minitest (~> 5.1)
@@ -224,21 +224,21 @@ GEM
224
224
  rack
225
225
  rack-test (0.6.3)
226
226
  rack (>= 1.0)
227
- rails (4.1.9)
228
- actionmailer (= 4.1.9)
229
- actionpack (= 4.1.9)
230
- actionview (= 4.1.9)
231
- activemodel (= 4.1.9)
232
- activerecord (= 4.1.9)
233
- activesupport (= 4.1.9)
227
+ rails (4.1.14.1)
228
+ actionmailer (= 4.1.14.1)
229
+ actionpack (= 4.1.14.1)
230
+ actionview (= 4.1.14.1)
231
+ activemodel (= 4.1.14.1)
232
+ activerecord (= 4.1.14.1)
233
+ activesupport (= 4.1.14.1)
234
234
  bundler (>= 1.3.0, < 2.0)
235
- railties (= 4.1.9)
235
+ railties (= 4.1.14.1)
236
236
  sprockets-rails (~> 2.0)
237
237
  rails_config (0.4.2)
238
238
  activesupport (>= 3.0)
239
- railties (4.1.9)
240
- actionpack (= 4.1.9)
241
- activesupport (= 4.1.9)
239
+ railties (4.1.14.1)
240
+ actionpack (= 4.1.14.1)
241
+ activesupport (= 4.1.14.1)
242
242
  rake (>= 0.8.7)
243
243
  thor (>= 0.18.1, < 2.0)
244
244
  rake (10.5.0)
@@ -392,7 +392,7 @@ DEPENDENCIES
392
392
  jquery-rails
393
393
  krikri!
394
394
  pry-rails
395
- rails (= 4.1.9)
395
+ rails (= 4.1.14.1)
396
396
  sass-rails (~> 4.0.3)
397
397
  sdoc (~> 0.4.0)
398
398
  sqlite3
@@ -7,7 +7,7 @@
7
7
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
8
  // compiled file.
9
9
  //
10
- // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
13
  //= require jquery
@@ -3,5 +3,5 @@
3
3
  # will use the application's secret key base instead.
4
4
  #
5
5
 
6
- # Blacklight.secret_key = 'ebc37207b10c8eca83db801d1048bab793a8989077927d0acd02dbf2510165f5e4d016d1c8c15c23c25dee94a9c1e1087ba5ede5dc94dce8fa4539cdcf93f270'
6
+ # Blacklight.secret_key = 'cc12cf6ecad283a96940ff1048f905f37fb193f90fb3f27864a00f9e11910c093279af59aa296c0ef2c18c0e325e59fd83ea20a66aa1db762c41211886820274'
7
7
 
@@ -4,7 +4,7 @@ Devise.setup do |config|
4
4
  # The secret key used by Devise. Devise uses this key to generate
5
5
  # random tokens. Changing this key will render invalid all existing
6
6
  # confirmation, reset password and unlock tokens in the database.
7
- # config.secret_key = '0b72f71851a885c429315093ac2db2dcd3823429a5a4f9f7c6ac233e8b2ecdc4cb6ecbc70b265102e87b6bd969325eed8197e6ac3cfdfe95f0b0fa335f180147'
7
+ # config.secret_key = '40ecf58b68fd1289ba1d8230901a4d066a5265f8f569e58a58adbdb05d26e95220beac0d20e9ff1c340093fc924b69dfb332a85427f37f748c0a520364be05b7'
8
8
 
9
9
  # ==> Mailer Configuration
10
10
  # Configure the e-mail address which will be shown in Devise::Mailer,
@@ -97,7 +97,7 @@ Devise.setup do |config|
97
97
  config.stretches = Rails.env.test? ? 1 : 10
98
98
 
99
99
  # Setup a pepper to generate the encrypted password.
100
- # config.pepper = '94ee00c9080cdb76c8c060c1af2f24299179ef43587ed58fa553da7ab56b4da1dc25c2b351f8ef027abafc2df9d53584566312c2a0586faac7edb43b46b9c905'
100
+ # config.pepper = '61f641377fee96c6de414fcb8ee81afbae5243d1c8fbc386b910eada4d445c79f429fee2415774134bed70cded219e56b96eb776ea8f16556ae589be15604e85'
101
101
 
102
102
  # ==> Configuration for :confirmable
103
103
  # A period that the user is allowed to access the website even without
@@ -11,10 +11,10 @@
11
11
  # if you're sharing your code publicly.
12
12
 
13
13
  development:
14
- secret_key_base: 54220d04d57b5dcc6dd2eadc805455695bda1ca0ed39225d5bf33b640fa983eeec53bb3e734a9af4b2c67dbae35033203ddb1e2a95851af90a0a6d66a34aa33c
14
+ secret_key_base: 863fff84d2a9894a7ebbe17f0f0d7dc2a74dc3ebe204d6b6b9732538cc1148476637020525b1c80a520c18e4f679cb3169b634ba797bd7e12a8ff47d2a266ab0
15
15
 
16
16
  test:
17
- secret_key_base: f3ba998d333d9560c0bf83d53703cd7efd707afa57ccc4d0a9f00029b26c78b4341e03799dd390ba88e41e199789d9fa330cd507c6e5e3756f3edc2a847ae83d
17
+ secret_key_base: 847e6a513b270df86d4aaed1a90d50cdd4309f019a7458e16f12cd03a15bca129056ee0da6616e8aed7dbb59fb99d228a5768d96abad6eb79146761815931e79
18
18
 
19
19
  # Do not keep production secrets in the repository,
20
20
  # instead read values from the environment.
Binary file
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20160304151249) do
14
+ ActiveRecord::Schema.define(version: 20160226160228) do
15
15
 
16
16
  create_table "bookmarks", force: true do |t|
17
17
  t.integer "user_id", null: false
Binary file
@@ -1,57 +1,57 @@
1
-  (6.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
1
+  (1.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
2
2
   (0.1ms) select sqlite_version(*)
3
-  (4.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4
- ActiveRecord::SchemaMigration Load (1.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
3
+  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
5
5
  Migrating to CreateKrikriInstitutions (20141113200614)
6
6
   (0.1ms) begin transaction
7
-  (2.8ms) CREATE TABLE "krikri_institutions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "notes" text, "created_at" datetime, "updated_at" datetime)
8
- SQL (1.3ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20141113200614"]]
9
-  (2.6ms) commit transaction
7
+  (0.4ms) CREATE TABLE "krikri_institutions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "notes" text, "created_at" datetime, "updated_at" datetime)
8
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20141113200614"]]
9
+  (0.6ms) commit transaction
10
10
  Migrating to CreateKrikriHarvestSources (20141113200643)
11
-  (0.1ms) begin transaction
12
-  (2.6ms) CREATE TABLE "krikri_harvest_sources" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "institution_id" integer, "name" varchar(255), "source_type" varchar(255), "metadata_schema" varchar(255), "uri" varchar(255), "notes" text, "created_at" datetime, "updated_at" datetime)
13
- SQL (0.8ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20141113200643"]]
14
-  (2.5ms) commit transaction
11
+  (0.0ms) begin transaction
12
+  (0.3ms) CREATE TABLE "krikri_harvest_sources" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "institution_id" integer, "name" varchar(255), "source_type" varchar(255), "metadata_schema" varchar(255), "uri" varchar(255), "notes" text, "created_at" datetime, "updated_at" datetime)
13
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20141113200643"]]
14
+  (0.6ms) commit transaction
15
15
  Migrating to CreateKrikriActivities (20141212220924)
16
16
   (0.1ms) begin transaction
17
-  (3.3ms) CREATE TABLE "krikri_activities" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "start_time" datetime, "end_time" datetime, "agent" varchar(255), "opts" varchar(255), "created_at" datetime, "updated_at" datetime)
18
- SQL (0.9ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20141212220924"]]
19
-  (2.2ms) commit transaction
17
+  (0.7ms) CREATE TABLE "krikri_activities" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "start_time" datetime, "end_time" datetime, "agent" varchar(255), "opts" varchar(255), "created_at" datetime, "updated_at" datetime)
18
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20141212220924"]]
19
+  (0.7ms) commit transaction
20
20
  Migrating to AddOptsToKrikriHarvestSources (20150106164218)
21
21
   (0.1ms) begin transaction
22
-  (3.3ms) ALTER TABLE "krikri_harvest_sources" ADD "opts" text
23
- SQL (0.9ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150106164218"]]
24
-  (2.8ms) commit transaction
22
+  (0.3ms) ALTER TABLE "krikri_harvest_sources" ADD "opts" text
23
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150106164218"]]
24
+  (0.6ms) commit transaction
25
25
  Migrating to ChangeOptsInKrikriActivities (20150309160112)
26
26
   (0.1ms) begin transaction
27
-  (0.3ms) CREATE TEMPORARY TABLE "akrikri_activities" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "start_time" datetime, "end_time" datetime, "agent" varchar(255), "opts" varchar(255), "created_at" datetime, "updated_at" datetime)
28
-  (1.4ms) SELECT * FROM "krikri_activities"
29
-  (2.2ms) DROP TABLE "krikri_activities"
30
-  (0.2ms) CREATE TABLE "krikri_activities" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "start_time" datetime, "end_time" datetime, "agent" varchar(255), "opts" text(255), "created_at" datetime, "updated_at" datetime) 
31
-  (0.1ms) SELECT * FROM "akrikri_activities"
27
+  (2.1ms) CREATE TEMPORARY TABLE "akrikri_activities" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "start_time" datetime, "end_time" datetime, "agent" varchar(255), "opts" varchar(255), "created_at" datetime, "updated_at" datetime)
28
+  (0.0ms) SELECT * FROM "krikri_activities"
29
+  (0.6ms) DROP TABLE "krikri_activities"
30
+  (0.1ms) CREATE TABLE "krikri_activities" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "start_time" datetime, "end_time" datetime, "agent" varchar(255), "opts" text(255), "created_at" datetime, "updated_at" datetime) 
31
+  (0.0ms) SELECT * FROM "akrikri_activities"
32
32
   (0.2ms) DROP TABLE "akrikri_activities"
33
- SQL (0.9ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150309160112"]]
34
-  (3.2ms) commit transaction
33
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150309160112"]]
34
+  (0.8ms) commit transaction
35
35
  Migrating to RemoveOptsLimitInKrikriActivities (20150310190054)
36
-  (0.4ms) begin transaction
37
-  (0.2ms) CREATE TEMPORARY TABLE "akrikri_activities" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "start_time" datetime, "end_time" datetime, "agent" varchar(255), "opts" text(255), "created_at" datetime, "updated_at" datetime) 
38
-  (1.5ms) SELECT * FROM "krikri_activities"
39
-  (2.4ms) DROP TABLE "krikri_activities"
36
+  (0.1ms) begin transaction
37
+  (0.3ms) CREATE TEMPORARY TABLE "akrikri_activities" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "start_time" datetime, "end_time" datetime, "agent" varchar(255), "opts" text(255), "created_at" datetime, "updated_at" datetime) 
38
+  (0.1ms) SELECT * FROM "krikri_activities"
39
+  (0.2ms) DROP TABLE "krikri_activities"
40
40
   (0.1ms) CREATE TABLE "krikri_activities" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "start_time" datetime, "end_time" datetime, "agent" varchar(255), "opts" text, "created_at" datetime, "updated_at" datetime)
41
41
   (0.1ms) SELECT * FROM "akrikri_activities"
42
42
   (0.1ms) DROP TABLE "akrikri_activities"
43
- SQL (0.7ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150310190054"]]
44
-  (2.6ms) commit transaction
43
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150310190054"]]
44
+  (0.7ms) commit transaction
45
45
  Migrating to AddQaReport (20150328035550)
46
46
   (0.1ms) begin transaction
47
-  (2.5ms) CREATE TABLE "krikri_qa_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "provider" varchar(255), "field_report" text, "count_report" text, "created_at" datetime, "updated_at" datetime)
48
- SQL (0.8ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150328035550"]]
49
-  (2.3ms) commit transaction
50
- Migrating to DeviseCreateUsers (20160304151204)
51
-  (0.1ms) begin transaction
52
-  (3.6ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL, "encrypted_password" varchar(255) DEFAULT '' NOT NULL, "reset_password_token" varchar(255), "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0 NOT NULL, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar(255), "last_sign_in_ip" varchar(255), "created_at" datetime, "updated_at" datetime)
53
-  (0.4ms) CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")
54
-  (0.3ms) SELECT sql
47
+  (0.3ms) CREATE TABLE "krikri_qa_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "provider" varchar(255), "field_report" text, "count_report" text, "created_at" datetime, "updated_at" datetime)
48
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150328035550"]]
49
+  (0.5ms) commit transaction
50
+ Migrating to DeviseCreateUsers (20160226160200)
51
+  (0.0ms) begin transaction
52
+  (0.3ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL, "encrypted_password" varchar(255) DEFAULT '' NOT NULL, "reset_password_token" varchar(255), "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0 NOT NULL, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar(255), "last_sign_in_ip" varchar(255), "created_at" datetime, "updated_at" datetime)
53
+  (0.3ms) CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")
54
+  (0.0ms) SELECT sql
55
55
  FROM sqlite_master
56
56
  WHERE name='index_users_on_email' AND type='index'
57
57
  UNION ALL
@@ -60,10 +60,10 @@ Migrating to DeviseCreateUsers (20160304151204)
60
60
  WHERE name='index_users_on_email' AND type='index'
61
61
 
62
62
   (0.1ms) CREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")
63
- SQL (1.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160304151204"]]
64
-  (2.7ms) commit transaction
65
- ActiveRecord::SchemaMigration Load (1.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
66
-  (1.7ms)  SELECT sql
63
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160226160200"]]
64
+  (0.8ms) commit transaction
65
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
66
+  (0.1ms)  SELECT sql
67
67
  FROM sqlite_master
68
68
  WHERE name='index_users_on_reset_password_token' AND type='index'
69
69
  UNION ALL
@@ -71,7 +71,7 @@ Migrating to DeviseCreateUsers (20160304151204)
71
71
  FROM sqlite_temp_master
72
72
  WHERE name='index_users_on_reset_password_token' AND type='index'
73
73
  
74
-  (1.3ms) SELECT sql
74
+  (0.1ms) SELECT sql
75
75
  FROM sqlite_master
76
76
  WHERE name='index_users_on_email' AND type='index'
77
77
  UNION ALL
@@ -79,27 +79,27 @@ Migrating to DeviseCreateUsers (20160304151204)
79
79
  FROM sqlite_temp_master
80
80
  WHERE name='index_users_on_email' AND type='index'
81
81
 
82
- ActiveRecord::SchemaMigration Load (1.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
83
- Migrating to CreateSearches (20160304151247)
82
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
83
+ Migrating to CreateSearches (20160226160226)
84
84
   (0.1ms) begin transaction
85
-  (4.4ms) CREATE TABLE "searches" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "query_params" text, "user_id" integer, "user_type" varchar(255), "created_at" datetime, "updated_at" datetime) 
86
-  (0.3ms) select sqlite_version(*)
87
-  (1.1ms) CREATE INDEX "index_searches_on_user_id" ON "searches" ("user_id")
88
- SQL (0.9ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160304151247"]]
89
-  (2.9ms) commit transaction
90
- Migrating to CreateBookmarks (20160304151248)
91
-  (0.1ms) begin transaction
92
-  (3.3ms) CREATE TABLE "bookmarks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer NOT NULL, "user_type" varchar(255), "document_id" varchar(255), "title" varchar(255), "created_at" datetime, "updated_at" datetime) 
93
- SQL (1.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160304151248"]]
94
-  (1.9ms) commit transaction
95
- Migrating to AddPolymorphicTypeToBookmarks (20160304151249)
96
-  (0.1ms) begin transaction
97
-  (3.3ms) ALTER TABLE "bookmarks" ADD "document_type" varchar(255)
98
-  (0.2ms) CREATE INDEX "index_bookmarks_on_user_id" ON "bookmarks" ("user_id")
99
- SQL (0.9ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160304151249"]]
100
-  (2.9ms) commit transaction
101
- ActiveRecord::SchemaMigration Load (1.9ms) SELECT "schema_migrations".* FROM "schema_migrations"
102
-  (1.8ms) SELECT sql
85
+  (1.0ms) CREATE TABLE "searches" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "query_params" text, "user_id" integer, "user_type" varchar(255), "created_at" datetime, "updated_at" datetime) 
86
+  (0.1ms) select sqlite_version(*)
87
+  (0.1ms) CREATE INDEX "index_searches_on_user_id" ON "searches" ("user_id")
88
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160226160226"]]
89
+  (0.6ms) commit transaction
90
+ Migrating to CreateBookmarks (20160226160227)
91
+  (0.0ms) begin transaction
92
+  (0.3ms) CREATE TABLE "bookmarks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer NOT NULL, "user_type" varchar(255), "document_id" varchar(255), "title" varchar(255), "created_at" datetime, "updated_at" datetime) 
93
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160226160227"]]
94
+  (0.6ms) commit transaction
95
+ Migrating to AddPolymorphicTypeToBookmarks (20160226160228)
96
+  (0.0ms) begin transaction
97
+  (0.3ms) ALTER TABLE "bookmarks" ADD "document_type" varchar(255)
98
+  (0.1ms) CREATE INDEX "index_bookmarks_on_user_id" ON "bookmarks" ("user_id")
99
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160226160228"]]
100
+  (0.7ms) commit transaction
101
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
102
+  (0.1ms) SELECT sql
103
103
  FROM sqlite_master
104
104
  WHERE name='index_bookmarks_on_user_id' AND type='index'
105
105
  UNION ALL
@@ -107,7 +107,7 @@ Migrating to AddPolymorphicTypeToBookmarks (20160304151249)
107
107
  FROM sqlite_temp_master
108
108
  WHERE name='index_bookmarks_on_user_id' AND type='index'
109
109
 
110
-  (2.1ms)  SELECT sql
110
+  (0.1ms)  SELECT sql
111
111
  FROM sqlite_master
112
112
  WHERE name='index_searches_on_user_id' AND type='index'
113
113
  UNION ALL
@@ -115,7 +115,7 @@ Migrating to AddPolymorphicTypeToBookmarks (20160304151249)
115
115
  FROM sqlite_temp_master
116
116
  WHERE name='index_searches_on_user_id' AND type='index'
117
117
  
118
-  (0.9ms) SELECT sql
118
+  (0.1ms) SELECT sql
119
119
  FROM sqlite_master
120
120
  WHERE name='index_users_on_reset_password_token' AND type='index'
121
121
  UNION ALL
@@ -123,7 +123,7 @@ Migrating to AddPolymorphicTypeToBookmarks (20160304151249)
123
123
  FROM sqlite_temp_master
124
124
  WHERE name='index_users_on_reset_password_token' AND type='index'
125
125
 
126
-  (1.6ms)  SELECT sql
126
+  (0.1ms)  SELECT sql
127
127
  FROM sqlite_master
128
128
  WHERE name='index_users_on_email' AND type='index'
129
129
  UNION ALL
@@ -131,18 +131,18 @@ Migrating to AddPolymorphicTypeToBookmarks (20160304151249)
131
131
  FROM sqlite_temp_master
132
132
  WHERE name='index_users_on_email' AND type='index'
133
133
  
134
-  (4.8ms) CREATE TABLE "bookmarks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer NOT NULL, "user_type" varchar(255), "document_id" varchar(255), "title" varchar(255), "created_at" datetime, "updated_at" datetime, "document_type" varchar(255))
135
-  (0.1ms) select sqlite_version(*)
136
-  (3.6ms) CREATE INDEX "index_bookmarks_on_user_id" ON "bookmarks" ("user_id")
137
-  (3.9ms) CREATE TABLE "krikri_activities" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "start_time" datetime, "end_time" datetime, "agent" varchar(255), "opts" text, "created_at" datetime, "updated_at" datetime) 
138
-  (3.9ms) CREATE TABLE "krikri_harvest_sources" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "institution_id" integer, "name" varchar(255), "source_type" varchar(255), "metadata_schema" varchar(255), "uri" varchar(255), "notes" text, "created_at" datetime, "updated_at" datetime, "opts" text)
139
-  (3.7ms) CREATE TABLE "krikri_institutions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "notes" text, "created_at" datetime, "updated_at" datetime) 
140
-  (3.3ms) CREATE TABLE "krikri_qa_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "provider" varchar(255), "field_report" text, "count_report" text, "created_at" datetime, "updated_at" datetime)
141
-  (5.1ms) CREATE TABLE "searches" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "query_params" text, "user_id" integer, "user_type" varchar(255), "created_at" datetime, "updated_at" datetime) 
142
-  (4.4ms) CREATE INDEX "index_searches_on_user_id" ON "searches" ("user_id")
143
-  (5.4ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL, "encrypted_password" varchar(255) DEFAULT '' NOT NULL, "reset_password_token" varchar(255), "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0 NOT NULL, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar(255), "last_sign_in_ip" varchar(255), "created_at" datetime, "updated_at" datetime) 
144
-  (4.0ms) CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")
145
-  (0.8ms)  SELECT sql
134
+  (0.8ms) CREATE TABLE "bookmarks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer NOT NULL, "user_type" varchar(255), "document_id" varchar(255), "title" varchar(255), "created_at" datetime, "updated_at" datetime, "document_type" varchar(255))
135
+  (0.0ms) select sqlite_version(*)
136
+  (0.7ms) CREATE INDEX "index_bookmarks_on_user_id" ON "bookmarks" ("user_id")
137
+  (0.7ms) CREATE TABLE "krikri_activities" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "start_time" datetime, "end_time" datetime, "agent" varchar(255), "opts" text, "created_at" datetime, "updated_at" datetime) 
138
+  (0.7ms) CREATE TABLE "krikri_harvest_sources" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "institution_id" integer, "name" varchar(255), "source_type" varchar(255), "metadata_schema" varchar(255), "uri" varchar(255), "notes" text, "created_at" datetime, "updated_at" datetime, "opts" text)
139
+  (0.8ms) CREATE TABLE "krikri_institutions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "notes" text, "created_at" datetime, "updated_at" datetime) 
140
+  (2.0ms) CREATE TABLE "krikri_qa_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "provider" varchar(255), "field_report" text, "count_report" text, "created_at" datetime, "updated_at" datetime)
141
+  (1.6ms) CREATE TABLE "searches" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "query_params" text, "user_id" integer, "user_type" varchar(255), "created_at" datetime, "updated_at" datetime) 
142
+  (1.5ms) CREATE INDEX "index_searches_on_user_id" ON "searches" ("user_id")
143
+  (0.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL, "encrypted_password" varchar(255) DEFAULT '' NOT NULL, "reset_password_token" varchar(255), "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0 NOT NULL, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar(255), "last_sign_in_ip" varchar(255), "created_at" datetime, "updated_at" datetime) 
144
+  (0.6ms) CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")
145
+  (0.1ms)  SELECT sql
146
146
  FROM sqlite_master
147
147
  WHERE name='index_users_on_email' AND type='index'
148
148
  UNION ALL
@@ -150,18 +150,18 @@ Migrating to AddPolymorphicTypeToBookmarks (20160304151249)
150
150
  FROM sqlite_temp_master
151
151
  WHERE name='index_users_on_email' AND type='index'
152
152
  
153
-  (5.3ms) CREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")
154
-  (4.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
155
-  (4.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
156
-  (1.2ms) SELECT version FROM "schema_migrations"
157
-  (4.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20160304151249')
158
-  (5.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20160304151204')
159
-  (4.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20160304151247')
160
-  (4.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20160304151248')
161
-  (4.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20141113200614')
162
-  (4.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20141113200643')
163
-  (3.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20141212220924')
164
-  (3.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150106164218')
165
-  (4.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20150309160112')
166
-  (3.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20150310190054')
167
-  (4.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20150328035550')
153
+  (0.7ms) CREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")
154
+  (0.7ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
155
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
156
+  (0.1ms) SELECT version FROM "schema_migrations"
157
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20160226160228')
158
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20160226160200')
159
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20160226160226')
160
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20160226160227')
161
+  (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20141113200614')
162
+  (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20141113200643')
163
+  (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20141212220924')
164
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20150106164218')
165
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150309160112')
166
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20150310190054')
167
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20150328035550')
@@ -92,15 +92,39 @@ describe Krikri::AsyncUriGetter do
92
92
  .to_raise(Faraday::ConnectionFailed)
93
93
  end
94
94
 
95
- it 'propagates exceptions to the calling thread when #join is called' do
96
- r = subject.add_request(uri: test_uri)
97
- expect { r.join }.to raise_error(Faraday::ConnectionFailed)
95
+ context 'without inline exceptions' do
96
+ it 'propagates exceptions to the calling thread when #join is called' do
97
+ r = subject.add_request(uri: test_uri)
98
+ expect { r.join }.to raise_error(Faraday::ConnectionFailed)
99
+ end
100
+
101
+ it 'propagates exceptions when the response is requested' do
102
+ r = subject.add_request(uri: test_uri)
103
+ expect { r.with_response { |_| } }
104
+ .to raise_error(Faraday::ConnectionFailed)
105
+ end
98
106
  end
99
107
 
100
- it 'propagates exceptions when the response is requested' do
101
- r = subject.add_request(uri: test_uri)
102
- expect { r.with_response { |_| } }
103
- .to raise_error(Faraday::ConnectionFailed)
108
+ context 'with inline exceptions' do
109
+ subject { described_class.new(opts: { inline_exceptions: true }) }
110
+
111
+ it 'does not throw an exception when #join is called' do
112
+ r = subject.add_request(uri: test_uri)
113
+ expect { r.join }.to_not raise_error
114
+ end
115
+
116
+ it 'passes the exception as a 5xx HTTP response' do
117
+ r = subject.add_request(uri: test_uri)
118
+ r.with_response do |response|
119
+ expect(response.status).to eq(500)
120
+ expect(response.body).to include('Exception')
121
+
122
+ headers = response.headers
123
+ expect(headers.keys).to include('X-Internal-Response')
124
+ expect(headers.keys).to include('X-Exception-Message')
125
+ expect(headers['X-Exception']).to be_kind_of(Exception)
126
+ end
127
+ end
104
128
  end
105
129
  end
106
130
  end
@@ -1,18 +1,50 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Krikri::EntityConsumer do
4
-
5
4
  before(:all) do
6
5
  DatabaseCleaner.clean_with(:truncation)
7
6
  create(:krikri_harvest_activity)
8
7
  create(:krikri_mapping_activity)
9
8
  end
10
9
 
11
- context 'as a mapper agent' do
12
- let(:generator_uri) { 'http://example.org/ldp/activity/2' }
13
- let(:opts) do
14
- {name: :agent_map, generator_uri: generator_uri}
10
+ subject { DummyAgent.new }
11
+ let(:generator_uri) { Krikri::Activity.base_uri / 2 }
12
+
13
+ before { class DummyAgent; include Krikri::EntityConsumer; end }
14
+ after { Object.send(:remove_const, :DummyAgent) }
15
+
16
+ describe 'deprecated interface' do
17
+ it 'sets the activity' do
18
+ expect { subject.assign_generator_activity!(generator_uri: generator_uri) }
19
+ .to change { subject.generator_activity }
20
+ .to Krikri::Activity.from_uri(generator_uri)
21
+ end
22
+
23
+ it 'activity defaults to nil' do
24
+ expect(subject.generator_activity).to be_nil
25
+ end
26
+
27
+ it 'integrates with new interface' do
28
+ expect { subject.assign_generator_activity!(generator_uri: generator_uri) }
29
+ .to change { subject.entity_source }
30
+ .to Krikri::Activity.from_uri(generator_uri)
15
31
  end
32
+ end
33
+
34
+ describe '#entities' do
35
+ it 'is empty when no source is available' do
36
+ expect(subject.entities).to be_empty
37
+ end
38
+ end
39
+
40
+ describe '#entity_source' do
41
+ it 'is nil by default' do
42
+ expect(subject.entities).to be_empty
43
+ end
44
+ end
45
+
46
+ context 'as a mapper agent' do
47
+ let(:opts) { { name: :agent_map, generator_uri: generator_uri } }
16
48
  let(:mapper_agent) { Krikri::Mapper::Agent.new(opts) }
17
49
 
18
50
  describe '#assign_generator_activity!' do
@@ -21,7 +53,5 @@ describe Krikri::EntityConsumer do
21
53
  .to respond_to(:entities)
22
54
  end
23
55
  end
24
-
25
56
  end
26
-
27
57
  end
@@ -4,8 +4,11 @@ describe Krikri::Harvester do
4
4
 
5
5
  # Our subject is an instance of a dummy class that mixes in
6
6
  # Krikri::Harvester.
7
- let(:klass) { class DummyHarvester; end; DummyHarvester }
8
- subject { klass.include(Krikri::Harvester).new(:uri => 'urn:fake_uri') }
7
+ before { class DummyHarvester; include(Krikri::Harvester); end }
8
+ after { Object.send(:remove_const, :DummyHarvester) }
9
+
10
+ let(:klass) { DummyHarvester }
11
+ subject { klass.new(:uri => 'urn:fake_uri') }
9
12
 
10
13
  context 'with record_ids implemented' do
11
14
  before do
@@ -33,7 +36,8 @@ describe Krikri::Harvester do
33
36
 
34
37
  describe '.entity_behavior' do
35
38
  it 'knows its entity behavior' do
36
- expect(klass.entity_behavior).to eq(Krikri::OriginalRecordEntityBehavior)
39
+ expect(subject.class.entity_behavior)
40
+ .to eq(Krikri::OriginalRecordEntityBehavior)
37
41
  end
38
42
  end
39
43
 
@@ -8,15 +8,18 @@ describe Krikri::Indexer do
8
8
 
9
9
  subject { described_class.new(opts) }
10
10
 
11
- enrichment_gen_uri_str = 'http://example.org/ldp/activity/5'
12
- behaves_opts = { generator_uri: enrichment_gen_uri_str,
11
+ enrichment_gen_uri = Krikri::Activity.base_uri / 5
12
+
13
+ behaves_opts = { generator_uri: enrichment_gen_uri,
13
14
  index_class: 'Krikri::QASearchIndex' }
14
15
 
15
- it_behaves_like 'a software agent', behaves_opts
16
+ it_behaves_like 'a software agent', behaves_opts do
17
+ after { clear_search_index }
18
+ end
16
19
 
17
20
  # See mapper_agent_spec.rb regarding :opts and behaves_opts...
18
21
  let(:opts) do
19
- { generator_uri: enrichment_gen_uri_str,
22
+ { generator_uri: enrichment_gen_uri,
20
23
  index_class: index_class.to_s }
21
24
  end
22
25