talia_core 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +41 -0
- data/bin/talia +33 -0
- data/lib/JXslt/jxslt.rb +60 -0
- data/lib/acts_as_roled.rb +11 -0
- data/lib/core_ext/platform.rb +9 -0
- data/lib/core_ext/string.rb +6 -0
- data/lib/core_ext.rb +1 -0
- data/lib/custom_template.rb +4 -0
- data/lib/loader_helper.rb +62 -0
- data/lib/mysql.rb +1214 -0
- data/lib/progressbar.rb +236 -0
- data/lib/role.rb +12 -0
- data/lib/talia_cl/command_line.rb +39 -0
- data/lib/talia_cl/commands/standalone/cl_options.rb +9 -0
- data/lib/talia_cl/commands/standalone/standalone_generate.rb +75 -0
- data/lib/talia_cl/commands/standalone.rb +25 -0
- data/lib/talia_cl/commands/talia_console/cl_options.rb +55 -0
- data/lib/talia_cl/commands/talia_console/console_commands.rb +37 -0
- data/lib/talia_cl/commands/talia_console/talia_commands.rb +131 -0
- data/lib/talia_cl/commands/talia_console.rb +47 -0
- data/lib/talia_cl/core_commands.rb +11 -0
- data/lib/talia_cl.rb +47 -0
- data/lib/talia_core/active_source.rb +372 -0
- data/lib/talia_core/active_source_parts/class_methods.rb +378 -0
- data/lib/talia_core/active_source_parts/predicate_handler.rb +89 -0
- data/lib/talia_core/active_source_parts/rdf.rb +131 -0
- data/lib/talia_core/active_source_parts/sql_helper.rb +36 -0
- data/lib/talia_core/active_source_parts/xml/base_builder.rb +47 -0
- data/lib/talia_core/active_source_parts/xml/generic_reader.rb +363 -0
- data/lib/talia_core/active_source_parts/xml/rdf_builder.rb +88 -0
- data/lib/talia_core/active_source_parts/xml/source_builder.rb +73 -0
- data/lib/talia_core/active_source_parts/xml/source_reader.rb +20 -0
- data/lib/talia_core/agent.rb +14 -0
- data/lib/talia_core/background_jobs/job.rb +82 -0
- data/lib/talia_core/background_jobs/progress_job.rb +68 -0
- data/lib/talia_core/collection.rb +13 -0
- data/lib/talia_core/data_types/data_loader.rb +92 -0
- data/lib/talia_core/data_types/data_record.rb +105 -0
- data/lib/talia_core/data_types/delayed_copier.rb +76 -0
- data/lib/talia_core/data_types/file_record.rb +59 -0
- data/lib/talia_core/data_types/file_store.rb +306 -0
- data/lib/talia_core/data_types/iip_data.rb +153 -0
- data/lib/talia_core/data_types/iip_loader.rb +127 -0
- data/lib/talia_core/data_types/image_data.rb +32 -0
- data/lib/talia_core/data_types/media_link.rb +19 -0
- data/lib/talia_core/data_types/mime_mapping.rb +45 -0
- data/lib/talia_core/data_types/path_helpers.rb +77 -0
- data/lib/talia_core/data_types/pdf_data.rb +42 -0
- data/lib/talia_core/data_types/simple_text.rb +36 -0
- data/lib/talia_core/data_types/temp_file_handling.rb +85 -0
- data/lib/talia_core/data_types/xml_data.rb +169 -0
- data/lib/talia_core/dc_resource.rb +20 -0
- data/lib/talia_core/dummy_handler.rb +34 -0
- data/lib/talia_core/dummy_source.rb +20 -0
- data/lib/talia_core/errors.rb +25 -0
- data/lib/talia_core/initializer.rb +427 -0
- data/lib/talia_core/ordered_source.rb +228 -0
- data/lib/talia_core/rails_ext/actionpack/action_controller/record_identifier.rb +13 -0
- data/lib/talia_core/rails_ext/actionpack/action_controller.rb +1 -0
- data/lib/talia_core/rails_ext/actionpack.rb +1 -0
- data/lib/talia_core/rails_ext.rb +1 -0
- data/lib/talia_core/rdf_import.rb +90 -0
- data/lib/talia_core/rdf_resource.rb +159 -0
- data/lib/talia_core/semantic_collection_item.rb +93 -0
- data/lib/talia_core/semantic_collection_wrapper.rb +324 -0
- data/lib/talia_core/semantic_property.rb +7 -0
- data/lib/talia_core/semantic_relation.rb +67 -0
- data/lib/talia_core/source.rb +323 -0
- data/lib/talia_core/source_transfer_object.rb +38 -0
- data/lib/talia_core/workflow/base.rb +15 -0
- data/lib/talia_core/workflow/publication_workflow.rb +62 -0
- data/lib/talia_core/workflow.rb +300 -0
- data/lib/talia_core.rb +9 -0
- data/lib/talia_dependencies.rb +12 -0
- data/lib/talia_util/bar_progressor.rb +15 -0
- data/lib/talia_util/configuration/config_file.rb +48 -0
- data/lib/talia_util/configuration/database_config.rb +40 -0
- data/lib/talia_util/configuration/mysql_database_setup.rb +104 -0
- data/lib/talia_util/data_import.rb +91 -0
- data/lib/talia_util/image_conversions.rb +82 -0
- data/lib/talia_util/import_job_helper.rb +132 -0
- data/lib/talia_util/io_helper.rb +54 -0
- data/lib/talia_util/progressable.rb +38 -0
- data/lib/talia_util/progressbar.rb +236 -0
- data/lib/talia_util/rdf_update.rb +80 -0
- data/lib/talia_util/some_sigla.xml +1960 -0
- data/lib/talia_util/test_helpers.rb +151 -0
- data/lib/talia_util/util.rb +226 -0
- data/lib/talia_util/yaml_import.rb +80 -0
- data/lib/talia_util.rb +13 -0
- data/lib/user.rb +116 -0
- data/lib/version.rb +15 -0
- data/test/core_ext/string_test.rb +11 -0
- data/test/custom_template_test.rb +8 -0
- data/test/talia_core/active_source_predicate_test.rb +54 -0
- data/test/talia_core/active_source_rdf_test.rb +89 -0
- data/test/talia_core/active_source_test.rb +631 -0
- data/test/talia_core/data_types/data_loader_test.rb +123 -0
- data/test/talia_core/data_types/data_record_test.rb +40 -0
- data/test/talia_core/data_types/file_record_test.rb +171 -0
- data/test/talia_core/data_types/iip_data_test.rb +130 -0
- data/test/talia_core/data_types/image_data_test.rb +88 -0
- data/test/talia_core/data_types/pdf_data_test.rb +68 -0
- data/test/talia_core/data_types/xml_data_test.rb +134 -0
- data/test/talia_core/generic_xml_test.rb +83 -0
- data/test/talia_core/initializer_test.rb +36 -0
- data/test/talia_core/ordered_source_test.rb +398 -0
- data/test/talia_core/rdf_resource_test.rb +115 -0
- data/test/talia_core/semantic_collection_item_test.rb +129 -0
- data/test/talia_core/source_reader_test.rb +33 -0
- data/test/talia_core/source_test.rb +484 -0
- data/test/talia_core/source_transfer_object_test.rb +24 -0
- data/test/talia_core/workflow/publication_workflow_test.rb +242 -0
- data/test/talia_core/workflow/user_class_for_workflow.rb +35 -0
- data/test/talia_core/workflow/workflow_base_test.rb +21 -0
- data/test/talia_core/workflow_test.rb +19 -0
- data/test/talia_util/import_job_helper_test.rb +46 -0
- data/test/test_helper.rb +68 -0
- metadata +262 -0
@@ -0,0 +1,242 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), 'user_class_for_workflow')
|
4
|
+
|
5
|
+
# Load the helper class
|
6
|
+
require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
|
7
|
+
|
8
|
+
|
9
|
+
module TaliaCore
|
10
|
+
class PublicationWorkflowTest < Test::Unit::TestCase
|
11
|
+
include TaliaCore::Workflow
|
12
|
+
|
13
|
+
def setup
|
14
|
+
@user = User.new
|
15
|
+
@user_without_autorization = UserWithoutAuthorization.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_initial_state_value
|
19
|
+
assert_equal :submitted, TaliaCore::Workflow::PublicationWorkflow.initial_state
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_column_was_set
|
23
|
+
assert_equal 'state', TaliaCore::Workflow::PublicationWorkflow.state_column
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_initial_state
|
27
|
+
TaliaCore::Workflow::PublicationWorkflow.delete_all
|
28
|
+
record = TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 1)
|
29
|
+
assert_equal :submitted, record.current_state
|
30
|
+
assert record.submitted?
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_states_were_set
|
34
|
+
[:submitted, :accepted, :rejected, :published].each do |s|
|
35
|
+
assert TaliaCore::Workflow::PublicationWorkflow.states.include?(s)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_event_methods_created
|
40
|
+
TaliaCore::Workflow::PublicationWorkflow.delete_all
|
41
|
+
record = TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 1)
|
42
|
+
%w(vote! direct_publish! publish!).each do |event|
|
43
|
+
assert record.respond_to?(event)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_query_methods_created
|
48
|
+
TaliaCore::Workflow::PublicationWorkflow.delete_all
|
49
|
+
record = TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 1)
|
50
|
+
%w(submitted? accepted? rejected? published?).each do |event|
|
51
|
+
assert record.respond_to?(event)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_transition_table
|
56
|
+
tt = TaliaCore::Workflow::PublicationWorkflow.transition_table
|
57
|
+
|
58
|
+
assert tt[:vote].include?(SupportingClasses::StateTransition.new(:from => :submitted, :to => :submitted))
|
59
|
+
assert tt[:vote].include?(SupportingClasses::StateTransition.new(:from => :submitted, :to => :accepted))
|
60
|
+
assert tt[:vote].include?(SupportingClasses::StateTransition.new(:from => :submitted, :to => :rejected))
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_next_state_for_event
|
64
|
+
TaliaCore::Workflow::PublicationWorkflow.delete_all
|
65
|
+
record = TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 1)
|
66
|
+
assert_equal :submitted, record.next_state_for_event(:vote)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_loopback_event
|
70
|
+
TaliaCore::Workflow::PublicationWorkflow.delete_all
|
71
|
+
record = TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 1)
|
72
|
+
record.vote! @user, 1
|
73
|
+
assert record.submitted?
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_can_go_to_accepted
|
77
|
+
TaliaCore::Workflow::PublicationWorkflow.delete_all
|
78
|
+
record = TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 1)
|
79
|
+
record.vote!(@user, 10)
|
80
|
+
assert_equal :accepted, record.current_state
|
81
|
+
assert_equal 10, record.state_properties[:vote]
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_can_go_to_rejected
|
85
|
+
TaliaCore::Workflow::PublicationWorkflow.delete_all
|
86
|
+
record = TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 1)
|
87
|
+
record.vote!(@user, -10)
|
88
|
+
assert_equal :rejected, record.current_state
|
89
|
+
assert_equal(-10, record.state_properties[:vote])
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_ignore_invalid_events
|
93
|
+
TaliaCore::Workflow::PublicationWorkflow.delete_all
|
94
|
+
record = TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 1)
|
95
|
+
# this is an invalid event for submitted state
|
96
|
+
record.publish!(@user)
|
97
|
+
assert_equal :submitted, record.current_state
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_direct_publish_event
|
101
|
+
TaliaCore::Workflow::PublicationWorkflow.delete_all
|
102
|
+
record = TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 1)
|
103
|
+
record.direct_publish!(@user)
|
104
|
+
assert_equal :published, record.current_state
|
105
|
+
assert_equal 0, record.state_properties[:vote]
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_vote_and_publish_event
|
109
|
+
TaliaCore::Workflow::PublicationWorkflow.delete_all
|
110
|
+
record = TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 1)
|
111
|
+
# go to accepted state
|
112
|
+
record.vote! @user, 10
|
113
|
+
assert_equal :accepted, record.current_state
|
114
|
+
|
115
|
+
# go to published state
|
116
|
+
record.publish! @user
|
117
|
+
assert_equal :published, record.current_state
|
118
|
+
end
|
119
|
+
|
120
|
+
# Write some code for this method if you need to implement an entry and/or exit actions
|
121
|
+
#
|
122
|
+
# def test_entry_and_exit_not_run_on_loopback_transition
|
123
|
+
#
|
124
|
+
# end
|
125
|
+
#
|
126
|
+
# def test_entry_and_after_actions_called_for_initial_state
|
127
|
+
#
|
128
|
+
# end
|
129
|
+
#
|
130
|
+
|
131
|
+
def test_find_first_in_state
|
132
|
+
# clear all records and create a new record
|
133
|
+
TaliaCore::Workflow::PublicationWorkflow.delete_all
|
134
|
+
record = TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 1)
|
135
|
+
|
136
|
+
# move current record to publish
|
137
|
+
record.vote! @user, 10
|
138
|
+
record.publish! @user
|
139
|
+
|
140
|
+
records_by_find_by = TaliaCore::Workflow::PublicationWorkflow.find_by_state('published')
|
141
|
+
records_by_in_state = TaliaCore::Workflow::PublicationWorkflow.find_in_state(:first, :published)
|
142
|
+
|
143
|
+
assert_equal records_by_find_by, records_by_in_state
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_find_all_in_state
|
147
|
+
# clear all records and create a new record
|
148
|
+
TaliaCore::Workflow::PublicationWorkflow.delete_all
|
149
|
+
record = TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 1)
|
150
|
+
|
151
|
+
# move current record to publish
|
152
|
+
record.vote! @user, 10
|
153
|
+
record.publish! @user
|
154
|
+
|
155
|
+
records_by_find_by = TaliaCore::Workflow::PublicationWorkflow.find_all_by_state('published')
|
156
|
+
records_by_in_state = TaliaCore::Workflow::PublicationWorkflow.find_in_state(:all, :published)
|
157
|
+
|
158
|
+
assert_equal records_by_find_by, records_by_in_state
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_find_all_in_state_with_conditions
|
162
|
+
# clear all records and create a new record
|
163
|
+
TaliaCore::Workflow::PublicationWorkflow.delete_all
|
164
|
+
TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 1)
|
165
|
+
TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 2)
|
166
|
+
|
167
|
+
# find all with conditions
|
168
|
+
records = TaliaCore::Workflow::PublicationWorkflow.find_in_state(:all, :submitted, :conditions => ['source_id > ?', '0'])
|
169
|
+
|
170
|
+
assert_equal 2, records.size
|
171
|
+
assert_equal 1, records.first.source_id
|
172
|
+
end
|
173
|
+
|
174
|
+
def test_find_first_in_state_with_conditions
|
175
|
+
# clear all records and create a new record
|
176
|
+
TaliaCore::Workflow::PublicationWorkflow.delete_all
|
177
|
+
TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 1)
|
178
|
+
TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 2)
|
179
|
+
|
180
|
+
# find all with conditions
|
181
|
+
records = TaliaCore::Workflow::PublicationWorkflow.find_in_state(:first, :submitted, :conditions => ['source_id = ?', '1'])
|
182
|
+
|
183
|
+
|
184
|
+
assert_equal 1, records.source_id
|
185
|
+
end
|
186
|
+
|
187
|
+
def test_count_in_state_with_conditions
|
188
|
+
# clear all records and create a new record
|
189
|
+
TaliaCore::Workflow::PublicationWorkflow.delete_all
|
190
|
+
TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 1)
|
191
|
+
TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 2)
|
192
|
+
|
193
|
+
cnt0 = TaliaCore::Workflow::PublicationWorkflow.count(:conditions => ['state = ?', 'submitted'])
|
194
|
+
cnt = TaliaCore::Workflow::PublicationWorkflow.count_in_state(:submitted)
|
195
|
+
|
196
|
+
assert_equal cnt0, cnt
|
197
|
+
end
|
198
|
+
|
199
|
+
|
200
|
+
def test_find_in_invalid_state_raises_exception
|
201
|
+
assert_raise(InvalidState) {
|
202
|
+
TaliaCore::Workflow::PublicationWorkflow.find_in_state(:all, :invalid_state)
|
203
|
+
}
|
204
|
+
end
|
205
|
+
|
206
|
+
def test_count_in_invalid_state_raises_exception
|
207
|
+
assert_raise(InvalidState) {
|
208
|
+
TaliaCore::Workflow::PublicationWorkflow.count_in_state(:invalid_state)
|
209
|
+
}
|
210
|
+
end
|
211
|
+
|
212
|
+
def test_not_authorized_user_raises_exception
|
213
|
+
# clear all records and create a new record
|
214
|
+
TaliaCore::Workflow::PublicationWorkflow.delete_all
|
215
|
+
record = TaliaCore::Workflow::PublicationWorkflow.create(:source_id => 1)
|
216
|
+
|
217
|
+
# call vote without user parameter
|
218
|
+
assert_raise(ArgumentError) {
|
219
|
+
record.vote!
|
220
|
+
}
|
221
|
+
|
222
|
+
# call vote without user parameter
|
223
|
+
assert_raise(NoMethodError) {
|
224
|
+
record.vote! 10
|
225
|
+
}
|
226
|
+
|
227
|
+
# call vote user not authorized
|
228
|
+
assert_raise(NoAuthorizedException) {
|
229
|
+
record.vote! @user_without_autorization, 10
|
230
|
+
}
|
231
|
+
end
|
232
|
+
|
233
|
+
def test_attach
|
234
|
+
src = Source.new('http://testattach.com/publication_workflow')
|
235
|
+
src.workflow = Workflow::PublicationWorkflow.new
|
236
|
+
src.save!
|
237
|
+
assert_kind_of(Workflow::PublicationWorkflow, Source.find(src.id).workflow)
|
238
|
+
end
|
239
|
+
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class User
|
2
|
+
|
3
|
+
attr_accessor :roles
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@roles = ['reviewer','admin', 'editor'].sort!
|
7
|
+
end
|
8
|
+
|
9
|
+
def authorized_as?(role_name)
|
10
|
+
if @roles.include?(role_name.to_s)
|
11
|
+
return true
|
12
|
+
else
|
13
|
+
return false
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
class UserWithoutAuthorization
|
20
|
+
|
21
|
+
attr_accessor :roles
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
@roles = []
|
25
|
+
end
|
26
|
+
|
27
|
+
def authorized_as?(role_name)
|
28
|
+
if @roles.include?(role_name.to_s)
|
29
|
+
return true
|
30
|
+
else
|
31
|
+
return false
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
# Load the helper class
|
4
|
+
require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
|
5
|
+
|
6
|
+
|
7
|
+
module TaliaCore
|
8
|
+
|
9
|
+
class WorkflowBaseTest < Test::Unit::TestCase
|
10
|
+
|
11
|
+
def test_initial_state_value
|
12
|
+
assert_raise(NoMethodError) {TaliaCore::Workflow::Base.initial_state}
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_column_was_set
|
16
|
+
assert_raise(NoMethodError) {TaliaCore::Workflow::Base.state_column}
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
# Load the helper class
|
4
|
+
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
5
|
+
|
6
|
+
|
7
|
+
module TaliaCore
|
8
|
+
module DataTypes
|
9
|
+
class WorkflowTest < Test::Unit::TestCase
|
10
|
+
|
11
|
+
def test_no_initial_value_raises_exception
|
12
|
+
assert_raise(TaliaCore::Workflow::NoInitialState) {
|
13
|
+
Workflow::Base.workflow_machine({})
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
2
|
+
require 'bj'
|
3
|
+
|
4
|
+
module TaliaCore
|
5
|
+
|
6
|
+
# Test the Generic Xml Import
|
7
|
+
class ImportJobHelperTest < Test::Unit::TestCase
|
8
|
+
|
9
|
+
def setup
|
10
|
+
setup_once(:flush) do
|
11
|
+
TaliaUtil::Util.flush_db
|
12
|
+
TaliaUtil::Util.flush_rdf
|
13
|
+
true
|
14
|
+
end
|
15
|
+
|
16
|
+
setup_once(:job) do
|
17
|
+
Bj::Table::Job.delete_all
|
18
|
+
Bj::Table::Job.new.save
|
19
|
+
job = Bj::Table::Job.find(:first)
|
20
|
+
ENV['JOB_ID'] = job.id.to_s
|
21
|
+
job
|
22
|
+
end
|
23
|
+
|
24
|
+
setup_once(:imported) do
|
25
|
+
ENV['xml'] = TestHelper.fixture_file('xml_test.xml')
|
26
|
+
importer = TaliaUtil::ImportJobHelper.new
|
27
|
+
importer.do_import
|
28
|
+
ActiveSource.find('http://xml_test/from_file')
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_import_success
|
34
|
+
assert(@imported)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_property
|
38
|
+
assert_property(@imported['http://localnode.org/localthi'], 'value')
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_relation
|
42
|
+
assert_property(@imported[N::RDF.relatit], DummySource.new('http://localnode.org/as_create_attr_dummy_2'), DummySource.new('http://localnode.org/as_create_attr_dummy_1'))
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
$: << File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib')
|
2
|
+
require 'fileutils'
|
3
|
+
require 'test/unit'
|
4
|
+
require 'core_ext'
|
5
|
+
require "talia_core"
|
6
|
+
require "talia_util/test_helpers"
|
7
|
+
require 'active_support/testing'
|
8
|
+
require 'active_support/test_case'
|
9
|
+
require 'active_record/fixtures'
|
10
|
+
|
11
|
+
module TaliaCore
|
12
|
+
# class Source
|
13
|
+
# public :instantiate_source_or_rdf_object
|
14
|
+
# end
|
15
|
+
|
16
|
+
class TestHelper
|
17
|
+
# Check if we have old (1.2.3-Rails) style ActiveRecord without fixture cache
|
18
|
+
@@new_ar = Fixtures.respond_to?(:reset_cache)
|
19
|
+
|
20
|
+
# connect the database
|
21
|
+
def self.startup
|
22
|
+
if(!TaliaCore::Initializer.initialized)
|
23
|
+
TaliaCore::Initializer.talia_root = File.join(File.dirname(__FILE__))
|
24
|
+
TaliaCore::Initializer.environment = "test"
|
25
|
+
# run the initializer
|
26
|
+
TaliaCore::Initializer.run("talia_core")
|
27
|
+
true
|
28
|
+
else
|
29
|
+
false
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.create_data_dir
|
34
|
+
ddir = TaliaCore::CONFIG['data_directory_location']
|
35
|
+
raise(RuntimeError, "No data directory configured") unless(ddir)
|
36
|
+
|
37
|
+
if(File.exist?(ddir))
|
38
|
+
raise(RuntimeError, "Data dir not a directory") unless(File.directory?(ddir))
|
39
|
+
if(File.exist?(File.join(ddir, 'README_FOR_TEST')))
|
40
|
+
puts "*** REMOVING data directory at #{ddir} - this should be used for testing only!"
|
41
|
+
FileUtils.rm_rf(ddir)
|
42
|
+
else
|
43
|
+
puts "*** WARNING: The #{ddir} directory does not seem to be an automatic test directory."
|
44
|
+
puts " Maybe something is wrong with your test/config/talia.yml ?"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
unless(File.exist?(ddir))
|
48
|
+
fixture_dir = File.join(Test::Unit::TestCase.fixture_path, 'data_for_test')
|
49
|
+
puts "Copying fixture data to data directory #{ddir} -> #{fixture_dir}"
|
50
|
+
FileUtils.cp_r(fixture_dir, ddir)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.fixture_file(filename)
|
55
|
+
File.join(Test::Unit::TestCase.fixture_path, filename)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
started = TestHelper.startup
|
60
|
+
Test::Unit::TestCase.fixture_path=File.join(File.dirname(__FILE__), 'fixtures')
|
61
|
+
Test::Unit::TestCase.set_fixture_class :active_sources => TaliaCore::ActiveSource,
|
62
|
+
:semantic_properties => TaliaCore::SemanticProperty,
|
63
|
+
:semantic_relations => TaliaCore::SemanticRelation,
|
64
|
+
:sources => TaliaCore::Source,
|
65
|
+
:data_records => TaliaCore::DataTypes::DataRecord
|
66
|
+
TestHelper.create_data_dir if(started)
|
67
|
+
|
68
|
+
end
|
metadata
ADDED
@@ -0,0 +1,262 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
extensions: []
|
3
|
+
|
4
|
+
homepage: http://trac.talia.discovery-project.eu/
|
5
|
+
executables:
|
6
|
+
- talia
|
7
|
+
version: !ruby/object:Gem::Version
|
8
|
+
version: 0.4.0
|
9
|
+
post_install_message:
|
10
|
+
date: 2009-10-13 22:00:00 +00:00
|
11
|
+
files:
|
12
|
+
- lib/JXslt/jxslt.rb
|
13
|
+
- lib/acts_as_roled.rb
|
14
|
+
- lib/core_ext.rb
|
15
|
+
- lib/core_ext/platform.rb
|
16
|
+
- lib/core_ext/string.rb
|
17
|
+
- lib/custom_template.rb
|
18
|
+
- lib/loader_helper.rb
|
19
|
+
- lib/mysql.rb
|
20
|
+
- lib/progressbar.rb
|
21
|
+
- lib/role.rb
|
22
|
+
- lib/talia_cl.rb
|
23
|
+
- lib/talia_cl/command_line.rb
|
24
|
+
- lib/talia_cl/commands/standalone.rb
|
25
|
+
- lib/talia_cl/commands/standalone/cl_options.rb
|
26
|
+
- lib/talia_cl/commands/standalone/standalone_generate.rb
|
27
|
+
- lib/talia_cl/commands/talia_console.rb
|
28
|
+
- lib/talia_cl/commands/talia_console/cl_options.rb
|
29
|
+
- lib/talia_cl/commands/talia_console/console_commands.rb
|
30
|
+
- lib/talia_cl/commands/talia_console/talia_commands.rb
|
31
|
+
- lib/talia_cl/core_commands.rb
|
32
|
+
- lib/talia_core.rb
|
33
|
+
- lib/talia_core/active_source.rb
|
34
|
+
- lib/talia_core/active_source_parts/class_methods.rb
|
35
|
+
- lib/talia_core/active_source_parts/predicate_handler.rb
|
36
|
+
- lib/talia_core/active_source_parts/rdf.rb
|
37
|
+
- lib/talia_core/active_source_parts/sql_helper.rb
|
38
|
+
- lib/talia_core/active_source_parts/xml/base_builder.rb
|
39
|
+
- lib/talia_core/active_source_parts/xml/generic_reader.rb
|
40
|
+
- lib/talia_core/active_source_parts/xml/rdf_builder.rb
|
41
|
+
- lib/talia_core/active_source_parts/xml/source_builder.rb
|
42
|
+
- lib/talia_core/active_source_parts/xml/source_reader.rb
|
43
|
+
- lib/talia_core/agent.rb
|
44
|
+
- lib/talia_core/background_jobs/job.rb
|
45
|
+
- lib/talia_core/background_jobs/progress_job.rb
|
46
|
+
- lib/talia_core/collection.rb
|
47
|
+
- lib/talia_core/data_types/data_loader.rb
|
48
|
+
- lib/talia_core/data_types/data_record.rb
|
49
|
+
- lib/talia_core/data_types/delayed_copier.rb
|
50
|
+
- lib/talia_core/data_types/file_record.rb
|
51
|
+
- lib/talia_core/data_types/file_store.rb
|
52
|
+
- lib/talia_core/data_types/iip_data.rb
|
53
|
+
- lib/talia_core/data_types/iip_loader.rb
|
54
|
+
- lib/talia_core/data_types/image_data.rb
|
55
|
+
- lib/talia_core/data_types/media_link.rb
|
56
|
+
- lib/talia_core/data_types/mime_mapping.rb
|
57
|
+
- lib/talia_core/data_types/path_helpers.rb
|
58
|
+
- lib/talia_core/data_types/pdf_data.rb
|
59
|
+
- lib/talia_core/data_types/simple_text.rb
|
60
|
+
- lib/talia_core/data_types/temp_file_handling.rb
|
61
|
+
- lib/talia_core/data_types/xml_data.rb
|
62
|
+
- lib/talia_core/dc_resource.rb
|
63
|
+
- lib/talia_core/dummy_handler.rb
|
64
|
+
- lib/talia_core/dummy_source.rb
|
65
|
+
- lib/talia_core/errors.rb
|
66
|
+
- lib/talia_core/initializer.rb
|
67
|
+
- lib/talia_core/ordered_source.rb
|
68
|
+
- lib/talia_core/rails_ext.rb
|
69
|
+
- lib/talia_core/rails_ext/actionpack.rb
|
70
|
+
- lib/talia_core/rails_ext/actionpack/action_controller.rb
|
71
|
+
- lib/talia_core/rails_ext/actionpack/action_controller/record_identifier.rb
|
72
|
+
- lib/talia_core/rdf_import.rb
|
73
|
+
- lib/talia_core/rdf_resource.rb
|
74
|
+
- lib/talia_core/semantic_collection_item.rb
|
75
|
+
- lib/talia_core/semantic_collection_wrapper.rb
|
76
|
+
- lib/talia_core/semantic_property.rb
|
77
|
+
- lib/talia_core/semantic_relation.rb
|
78
|
+
- lib/talia_core/source.rb
|
79
|
+
- lib/talia_core/source_transfer_object.rb
|
80
|
+
- lib/talia_core/workflow.rb
|
81
|
+
- lib/talia_core/workflow/base.rb
|
82
|
+
- lib/talia_core/workflow/publication_workflow.rb
|
83
|
+
- lib/talia_dependencies.rb
|
84
|
+
- lib/talia_util.rb
|
85
|
+
- lib/talia_util/bar_progressor.rb
|
86
|
+
- lib/talia_util/configuration/config_file.rb
|
87
|
+
- lib/talia_util/configuration/database_config.rb
|
88
|
+
- lib/talia_util/configuration/mysql_database_setup.rb
|
89
|
+
- lib/talia_util/data_import.rb
|
90
|
+
- lib/talia_util/image_conversions.rb
|
91
|
+
- lib/talia_util/import_job_helper.rb
|
92
|
+
- lib/talia_util/io_helper.rb
|
93
|
+
- lib/talia_util/progressable.rb
|
94
|
+
- lib/talia_util/progressbar.rb
|
95
|
+
- lib/talia_util/rdf_update.rb
|
96
|
+
- lib/talia_util/some_sigla.xml
|
97
|
+
- lib/talia_util/test_helpers.rb
|
98
|
+
- lib/talia_util/util.rb
|
99
|
+
- lib/talia_util/yaml_import.rb
|
100
|
+
- lib/user.rb
|
101
|
+
- lib/version.rb
|
102
|
+
- README.rdoc
|
103
|
+
rubygems_version: 1.3.5
|
104
|
+
rdoc_options:
|
105
|
+
- --charset=UTF-8
|
106
|
+
signing_key:
|
107
|
+
cert_chain: []
|
108
|
+
|
109
|
+
name: talia_core
|
110
|
+
has_rdoc: true
|
111
|
+
platform: ruby
|
112
|
+
summary: The core elements of the Talia Digital Library system
|
113
|
+
default_executable: talia
|
114
|
+
bindir: bin
|
115
|
+
licenses: []
|
116
|
+
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
version:
|
119
|
+
requirements:
|
120
|
+
- - '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: "0"
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
version:
|
125
|
+
requirements:
|
126
|
+
- - '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: 1.8.6
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
specification_version: 3
|
132
|
+
test_files:
|
133
|
+
- test/custom_template_test.rb
|
134
|
+
- test/test_helper.rb
|
135
|
+
- test/core_ext/string_test.rb
|
136
|
+
- test/talia_core/active_source_predicate_test.rb
|
137
|
+
- test/talia_core/active_source_rdf_test.rb
|
138
|
+
- test/talia_core/active_source_test.rb
|
139
|
+
- test/talia_core/generic_xml_test.rb
|
140
|
+
- test/talia_core/initializer_test.rb
|
141
|
+
- test/talia_core/ordered_source_test.rb
|
142
|
+
- test/talia_core/rdf_resource_test.rb
|
143
|
+
- test/talia_core/semantic_collection_item_test.rb
|
144
|
+
- test/talia_core/source_reader_test.rb
|
145
|
+
- test/talia_core/source_test.rb
|
146
|
+
- test/talia_core/source_transfer_object_test.rb
|
147
|
+
- test/talia_core/workflow_test.rb
|
148
|
+
- test/talia_core/data_types/data_loader_test.rb
|
149
|
+
- test/talia_core/data_types/data_record_test.rb
|
150
|
+
- test/talia_core/data_types/file_record_test.rb
|
151
|
+
- test/talia_core/data_types/iip_data_test.rb
|
152
|
+
- test/talia_core/data_types/image_data_test.rb
|
153
|
+
- test/talia_core/data_types/pdf_data_test.rb
|
154
|
+
- test/talia_core/data_types/xml_data_test.rb
|
155
|
+
- test/talia_core/workflow/publication_workflow_test.rb
|
156
|
+
- test/talia_core/workflow/user_class_for_workflow.rb
|
157
|
+
- test/talia_core/workflow/workflow_base_test.rb
|
158
|
+
- test/talia_util/import_job_helper_test.rb
|
159
|
+
dependencies:
|
160
|
+
- !ruby/object:Gem::Dependency
|
161
|
+
type: :runtime
|
162
|
+
name: activerecord
|
163
|
+
version_requirement:
|
164
|
+
version_requirements: !ruby/object:Gem::Requirement
|
165
|
+
version:
|
166
|
+
requirements:
|
167
|
+
- - '>='
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: 1.99.1
|
170
|
+
- !ruby/object:Gem::Dependency
|
171
|
+
type: :runtime
|
172
|
+
name: activesupport
|
173
|
+
version_requirement:
|
174
|
+
version_requirements: !ruby/object:Gem::Requirement
|
175
|
+
version:
|
176
|
+
requirements:
|
177
|
+
- - '>='
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: 1.99.1
|
180
|
+
- !ruby/object:Gem::Dependency
|
181
|
+
type: :runtime
|
182
|
+
name: activerdf
|
183
|
+
version_requirement:
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
version:
|
186
|
+
requirements:
|
187
|
+
- - '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: 1.7.0
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
type: :runtime
|
192
|
+
name: assit
|
193
|
+
version_requirement:
|
194
|
+
version_requirements: !ruby/object:Gem::Requirement
|
195
|
+
version:
|
196
|
+
requirements:
|
197
|
+
- - '>='
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: 0.0.1
|
200
|
+
- !ruby/object:Gem::Dependency
|
201
|
+
type: :runtime
|
202
|
+
name: semantic_naming
|
203
|
+
version_requirement:
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
version:
|
206
|
+
requirements:
|
207
|
+
- - '>='
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: 0.0.1
|
210
|
+
- !ruby/object:Gem::Dependency
|
211
|
+
type: :runtime
|
212
|
+
name: builder
|
213
|
+
version_requirement:
|
214
|
+
version_requirements: !ruby/object:Gem::Requirement
|
215
|
+
version:
|
216
|
+
requirements:
|
217
|
+
- - '>='
|
218
|
+
- !ruby/object:Gem::Version
|
219
|
+
version: 2.1.2
|
220
|
+
- !ruby/object:Gem::Dependency
|
221
|
+
type: :runtime
|
222
|
+
name: optiflag
|
223
|
+
version_requirement:
|
224
|
+
version_requirements: !ruby/object:Gem::Requirement
|
225
|
+
version:
|
226
|
+
requirements:
|
227
|
+
- - '>='
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: 0.6.5
|
230
|
+
- !ruby/object:Gem::Dependency
|
231
|
+
type: :runtime
|
232
|
+
name: rake
|
233
|
+
version_requirement:
|
234
|
+
version_requirements: !ruby/object:Gem::Requirement
|
235
|
+
version:
|
236
|
+
requirements:
|
237
|
+
- - '>='
|
238
|
+
- !ruby/object:Gem::Version
|
239
|
+
version: 0.7.1
|
240
|
+
- !ruby/object:Gem::Dependency
|
241
|
+
type: :runtime
|
242
|
+
name: json
|
243
|
+
version_requirement:
|
244
|
+
version_requirements: !ruby/object:Gem::Requirement
|
245
|
+
version:
|
246
|
+
requirements:
|
247
|
+
- - '>='
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: 1.1.0
|
250
|
+
description: This is the core plugin for building a digital library with Talia/Rails.
|
251
|
+
email: ghub@limitedcreativity.org
|
252
|
+
authors:
|
253
|
+
- Danilo Giacomi
|
254
|
+
- Roberto Tofani
|
255
|
+
- Luca Guidi
|
256
|
+
- Daniel Hahn
|
257
|
+
extra_rdoc_files:
|
258
|
+
- README.rdoc
|
259
|
+
requirements:
|
260
|
+
- rdflib (Redland RDF) + Ruby bindings (for Redland store)
|
261
|
+
rubyforge_project:
|
262
|
+
autorequire:
|