caruby-tissue 1.5.6 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +17 -0
- data/History.md +5 -1
- data/README.md +2 -2
- data/bin/crtdump +2 -8
- data/bin/crtexample +2 -5
- data/bin/crtmigrate +3 -6
- data/bin/crtsmoke +3 -8
- data/conf/wustl/{log4j.properties → linux/log4j.properties} +3 -3
- data/conf/wustl/windows/log4j.properties +40 -0
- data/examples/galena/Gemfile +16 -0
- data/examples/galena/Gemfile.lock +88 -0
- data/examples/galena/README.md +16 -16
- data/examples/galena/Rakefile +30 -0
- data/examples/galena/bin/seed +5 -11
- data/examples/galena/conf/annotation/defaults.yaml +2 -0
- data/examples/galena/conf/{migration/annotation_fields.yaml → annotation/fields.yaml} +2 -4
- data/examples/galena/conf/defaults.yaml +9 -0
- data/examples/galena/conf/{migration/filter_fields.yaml → filter/fields.yaml} +0 -1
- data/examples/galena/conf/filter/values.yaml +8 -0
- data/examples/galena/conf/{migration/frozen_defaults.yaml → frozen/defaults.yaml} +0 -0
- data/examples/galena/conf/{migration/frozen_fields.yaml → frozen/fields.yaml} +0 -2
- data/examples/galena/conf/{migration/general_fields.yaml → general/fields.yaml} +0 -24
- data/examples/galena/conf/registration/fields.yaml +6 -0
- data/examples/galena/conf/{migration/simple_fields.yaml → simple/fields.yaml} +1 -6
- data/examples/galena/data/annotation.csv +1 -1
- data/examples/galena/data/filter.csv +1 -1
- data/examples/galena/data/frozen.csv +1 -1
- data/examples/galena/data/general.csv +1 -1
- data/examples/galena/data/registration.csv +1 -1
- data/examples/galena/data/simple.csv +1 -1
- data/examples/galena/galena.gemspec +24 -0
- data/examples/galena/lib/galena/filter.rb +25 -0
- data/examples/galena/lib/galena/{tissue/migration/frozen_shims.rb → frozen.rb} +6 -10
- data/examples/galena/lib/galena/seed.rb +126 -0
- data/examples/galena/lib/galena/version.rb +3 -0
- data/examples/galena/lib/galena.rb +18 -7
- data/examples/galena/log/galena.log +37351 -0
- data/examples/galena/log/galena.log.0 +147830 -0
- data/examples/galena/spec/annotation_spec.rb +46 -0
- data/examples/galena/spec/filter_spec.rb +94 -0
- data/examples/galena/spec/frozen_spec.rb +39 -0
- data/examples/galena/spec/general_spec.rb +62 -0
- data/examples/galena/spec/registration_spec.rb +37 -0
- data/examples/galena/spec/seed.rb +107 -0
- data/examples/galena/spec/simple_spec.rb +58 -0
- data/examples/galena/spec/spec_helper.rb +11 -0
- data/examples/galena/spec/support/migration.rb +70 -0
- data/lib/catissue/annotation/annotatable.rb +10 -8
- data/lib/catissue/annotation/annotation.rb +7 -7
- data/lib/catissue/annotation/de_integration.rb +9 -20
- data/lib/catissue/annotation/importer.rb +148 -0
- data/lib/catissue/annotation/introspector.rb +32 -0
- data/lib/catissue/annotation/metadata.rb +422 -0
- data/lib/catissue/annotation/proxy.rb +2 -2
- data/lib/catissue/annotation/proxy_class.rb +45 -30
- data/lib/catissue/annotation/record_entry_proxy.rb +2 -2
- data/lib/catissue/cli/command.rb +14 -24
- data/lib/catissue/cli/example.rb +5 -3
- data/lib/catissue/cli/migrate.rb +45 -37
- data/lib/catissue/cli/smoke.rb +2 -3
- data/lib/catissue/database/annotation/annotation_service.rb +8 -17
- data/lib/catissue/database/annotation/entity_facade.rb +33 -30
- data/lib/catissue/database/annotation/id_generator.rb +1 -1
- data/lib/catissue/database/annotation/integration_service.rb +11 -4
- data/lib/catissue/database/annotation/reference_writer.rb +38 -38
- data/lib/catissue/database/controlled_value_finder.rb +13 -28
- data/lib/catissue/database/controlled_values.rb +73 -45
- data/lib/catissue/database.rb +637 -277
- data/lib/catissue/domain/abstract_domain_object.rb +5 -0
- data/lib/catissue/domain/abstract_position.rb +3 -5
- data/lib/catissue/domain/abstract_specimen.rb +79 -65
- data/lib/catissue/domain/abstract_specimen_collection_group.rb +3 -6
- data/lib/catissue/domain/address.rb +0 -2
- data/lib/catissue/domain/cancer_research_group.rb +0 -3
- data/lib/catissue/domain/capacity.rb +2 -4
- data/lib/catissue/domain/check_in_check_out_event_parameter.rb +0 -3
- data/lib/catissue/domain/collection_event_parameters.rb +2 -7
- data/lib/catissue/domain/collection_protocol.rb +11 -16
- data/lib/catissue/domain/collection_protocol_event.rb +19 -12
- data/lib/catissue/domain/collection_protocol_registration.rb +8 -12
- data/lib/catissue/domain/consent_tier_response.rb +0 -4
- data/lib/catissue/domain/consent_tier_status.rb +1 -4
- data/lib/catissue/domain/container.rb +10 -10
- data/lib/catissue/domain/container_position.rb +4 -7
- data/lib/catissue/domain/container_type.rb +4 -7
- data/lib/catissue/domain/department.rb +0 -3
- data/lib/catissue/domain/disposal_event_parameters.rb +5 -5
- data/lib/catissue/domain/embedded_event_parameters.rb +1 -4
- data/lib/catissue/domain/external_identifier.rb +0 -12
- data/lib/catissue/domain/frozen_event_parameters.rb +1 -4
- data/lib/catissue/domain/institution.rb +0 -3
- data/lib/catissue/domain/new_specimen_array_order_item.rb +0 -5
- data/lib/catissue/domain/order_details.rb +0 -2
- data/lib/catissue/domain/participant/clinical/chemotherapy.rb +1 -3
- data/lib/catissue/domain/participant/clinical/duration.rb +2 -4
- data/lib/catissue/domain/participant/clinical/radiation_therapy.rb +2 -4
- data/lib/catissue/domain/participant.rb +22 -24
- data/lib/catissue/domain/participant_medical_identifier.rb +0 -4
- data/lib/catissue/domain/password.rb +0 -4
- data/lib/catissue/domain/race.rb +0 -3
- data/lib/catissue/domain/received_event_parameters.rb +3 -6
- data/lib/catissue/domain/site.rb +1 -4
- data/lib/catissue/domain/specimen/pathology/additional_finding.rb +12 -0
- data/lib/catissue/domain/specimen/pathology/details.rb +12 -0
- data/lib/catissue/domain/specimen/pathology/gleason_score.rb +12 -0
- data/lib/catissue/domain/specimen/pathology/histologic_grade.rb +12 -0
- data/lib/catissue/domain/specimen/pathology/histologic_type.rb +19 -0
- data/lib/catissue/domain/specimen/pathology/histologic_variant_type.rb +12 -0
- data/lib/catissue/domain/specimen/pathology/invasion.rb +12 -0
- data/lib/catissue/domain/specimen/pathology/prostate_specimen_gleason_score.rb +5 -11
- data/lib/catissue/domain/specimen/pathology/prostate_specimen_pathology_annotation.rb +12 -12
- data/lib/catissue/domain/specimen/pathology/specimen_additional_finding.rb +5 -14
- data/lib/catissue/domain/specimen/pathology/specimen_base_solid_tissue_pathology_annotation.rb +6 -21
- data/lib/catissue/domain/specimen/pathology/specimen_details.rb +4 -10
- data/lib/catissue/domain/specimen/pathology/specimen_histologic_grade.rb +4 -10
- data/lib/catissue/domain/specimen/pathology/specimen_histologic_type.rb +6 -14
- data/lib/catissue/domain/specimen/pathology/specimen_histologic_variant_type.rb +5 -11
- data/lib/catissue/domain/specimen/pathology/specimen_invasion.rb +5 -11
- data/lib/catissue/domain/specimen.rb +113 -76
- data/lib/catissue/domain/specimen_array.rb +0 -3
- data/lib/catissue/domain/specimen_array_content.rb +1 -4
- data/lib/catissue/domain/specimen_array_type.rb +1 -4
- data/lib/catissue/domain/specimen_characteristics.rb +0 -3
- data/lib/catissue/domain/specimen_collection_group/pathology/base_pathology_annotation.rb +2 -4
- data/lib/catissue/domain/specimen_collection_group/pathology/base_solid_tissue_pathology_annotation.rb +2 -4
- data/lib/catissue/domain/specimen_collection_group.rb +43 -53
- data/lib/catissue/domain/specimen_event_parameters.rb +24 -32
- data/lib/catissue/domain/specimen_position.rb +8 -5
- data/lib/catissue/domain/specimen_protocol.rb +3 -6
- data/lib/catissue/domain/specimen_requirement.rb +22 -20
- data/lib/catissue/domain/storage_container.rb +9 -12
- data/lib/catissue/domain/storage_type.rb +6 -10
- data/lib/catissue/domain/transfer_event_parameters.rb +3 -6
- data/lib/catissue/domain/user.rb +22 -29
- data/lib/catissue/{util → helpers}/collectible.rb +23 -18
- data/lib/catissue/helpers/collectible_event_parameters.rb +68 -0
- data/lib/catissue/helpers/controlled_value.rb +35 -0
- data/lib/catissue/{domain → helpers}/hash_code.rb +0 -0
- data/lib/catissue/{util → helpers}/location.rb +6 -5
- data/lib/catissue/helpers/log.rb +4 -0
- data/lib/catissue/{util → helpers}/person.rb +1 -1
- data/lib/catissue/{util → helpers}/position.rb +10 -8
- data/lib/catissue/helpers/properties_loader.rb +143 -0
- data/lib/catissue/{util → helpers}/storable.rb +2 -1
- data/lib/catissue/{util → helpers}/storage_type_holder.rb +9 -3
- data/lib/catissue/{annotation/annotatable_class.rb → metadata.rb} +73 -95
- data/lib/catissue/migration/migratable.rb +93 -44
- data/lib/catissue/migration/migrator.rb +26 -42
- data/lib/catissue/migration/shims.rb +1 -1
- data/lib/catissue/migration/unique.rb +76 -0
- data/lib/catissue/resource.rb +16 -20
- data/lib/catissue/version.rb +1 -1
- data/lib/catissue/wustl/logger.rb +52 -32
- data/lib/catissue.rb +38 -20
- data/test/lib/catissue/database/controlled_values_test.rb +22 -27
- data/test/lib/catissue/database/database_test.rb +18 -0
- data/test/lib/catissue/domain/address_test.rb +9 -11
- data/test/lib/catissue/domain/ca_tissue_test_defaults_test.rb +5 -16
- data/test/lib/catissue/domain/capacity_test.rb +2 -2
- data/test/lib/catissue/domain/collection_event_parameters_test.rb +16 -8
- data/test/lib/catissue/domain/collection_protocol_event_test.rb +1 -1
- data/test/lib/catissue/domain/collection_protocol_registration_test.rb +26 -16
- data/test/lib/catissue/domain/collection_protocol_test.rb +2 -2
- data/test/lib/catissue/domain/container_position_test.rb +7 -4
- data/test/lib/catissue/domain/department_test.rb +3 -3
- data/test/lib/catissue/domain/disposal_event_parameters_test.rb +1 -1
- data/test/lib/catissue/domain/external_identifier_test.rb +5 -1
- data/test/lib/catissue/domain/location_test.rb +4 -4
- data/test/lib/catissue/domain/participant_medical_identifier_test.rb +3 -3
- data/test/lib/catissue/domain/participant_test.rb +33 -20
- data/test/lib/catissue/domain/received_event_parameters_test.rb +19 -0
- data/test/lib/catissue/domain/site_test.rb +2 -2
- data/test/lib/catissue/domain/specimen_array_test.rb +3 -3
- data/test/lib/catissue/domain/specimen_array_type_test.rb +6 -6
- data/test/lib/catissue/domain/specimen_characteristics_test.rb +1 -1
- data/test/lib/catissue/domain/specimen_collection_group_test.rb +49 -13
- data/test/lib/catissue/domain/specimen_event_parameters_test.rb +4 -4
- data/test/lib/catissue/domain/specimen_position_test.rb +1 -1
- data/test/lib/catissue/domain/specimen_requirement_test.rb +2 -2
- data/test/lib/catissue/domain/specimen_test.rb +58 -24
- data/test/lib/catissue/domain/storage_container_test.rb +3 -16
- data/test/lib/catissue/domain/storage_type_test.rb +3 -3
- data/test/lib/catissue/domain/transfer_event_parameters_test.rb +17 -17
- data/test/lib/catissue/domain/user_test.rb +32 -34
- data/test/lib/catissue/helpers/properties_loader_test.rb +19 -0
- data/test/lib/catissue/migration/{test_case.rb → helpers/test_case.rb} +30 -20
- data/test/lib/examples/galena/tissue/domain/examples_test.rb +28 -38
- data/test/lib/examples/galena/tissue/helpers/test_case.rb +24 -0
- metadata +175 -99
- data/bin/crtextract +0 -47
- data/examples/galena/conf/extract/simple_fields.yaml +0 -4
- data/examples/galena/conf/migration/annotation_defaults.yaml +0 -2
- data/examples/galena/conf/migration/filter_defaults.yaml +0 -1
- data/examples/galena/conf/migration/filter_values.yaml +0 -13
- data/examples/galena/conf/migration/participant_fields.yaml +0 -4
- data/examples/galena/conf/migration/registration_fields.yaml +0 -5
- data/examples/galena/data/participant.csv +0 -1
- data/examples/galena/lib/galena/tissue/migration/filter_shims.rb +0 -41
- data/examples/galena/lib/galena/tissue/seed/defaults.rb +0 -127
- data/examples/psbin/README.md +0 -45
- data/examples/psbin/conf/adjuvant_hormone_defaults.yaml +0 -2
- data/examples/psbin/conf/adjuvant_radiation_defaults.yaml +0 -3
- data/examples/psbin/conf/biopsy_defaults.yaml +0 -3
- data/examples/psbin/conf/biopsy_fields.yaml +0 -9
- data/examples/psbin/conf/neoadjuvant_hormone_defaults.yaml +0 -2
- data/examples/psbin/conf/neoadjuvant_radiation_defaults.yaml +0 -3
- data/examples/psbin/conf/patient_defaults.yaml +0 -3
- data/examples/psbin/conf/patient_fields.yaml +0 -5
- data/examples/psbin/conf/surgery_defaults.yaml +0 -4
- data/examples/psbin/conf/surgery_fields.yaml +0 -15
- data/examples/psbin/conf/t_stage_defaults.yaml +0 -1
- data/examples/psbin/conf/t_stage_fields.yaml +0 -4
- data/examples/psbin/conf/therapy_fields.yaml +0 -5
- data/examples/psbin/data/adjuvant_hormone.csv +0 -1
- data/examples/psbin/data/adjuvant_radiation.csv +0 -1
- data/examples/psbin/data/biopsy.csv +0 -1
- data/examples/psbin/data/neoadjuvant_hormone.csv +0 -1
- data/examples/psbin/data/neoadjuvant_radiation.csv +0 -1
- data/examples/psbin/data/patient.csv +0 -1
- data/examples/psbin/data/surgery.csv +0 -1
- data/examples/psbin/data/t_stage.csv +0 -1
- data/examples/psbin/lib/psbin/biopsy_shims.rb +0 -15
- data/examples/psbin/lib/psbin/surgery_shims.rb +0 -15
- data/lib/catissue/annotation/annotation_class.rb +0 -406
- data/lib/catissue/annotation/annotation_module.rb +0 -106
- data/lib/catissue/domain.rb +0 -26
- data/lib/catissue/extract/command.rb +0 -31
- data/lib/catissue/extract/delta.rb +0 -58
- data/lib/catissue/extract/extractor.rb +0 -99
- data/lib/catissue/migration/uniquify.rb +0 -2
- data/lib/catissue/util/collectible_event_parameters.rb +0 -71
- data/lib/catissue/util/controlled_value.rb +0 -29
- data/lib/catissue/util/uniquify.rb +0 -86
- data/test/fixtures/catissue/domain/conf/catissue_override.yaml +0 -9
- data/test/fixtures/catissue/extract/conf/scg_extract.yaml +0 -3
- data/test/fixtures/catissue/extract/conf/scg_fields.yaml +0 -3
- data/test/fixtures/catissue/extract/conf/spc_extract.yaml +0 -3
- data/test/fixtures/catissue/extract/conf/spc_fields.yaml +0 -4
- data/test/fixtures/lib/catissue/defaults_test_fixture.rb +0 -206
- data/test/fixtures/lib/examples/galena/migration/alt_key_shims.rb +0 -7
- data/test/lib/catissue/domain/base_haemotology_pathology_test.rb +0 -24
- data/test/lib/catissue/extract/delta_test.rb +0 -25
- data/test/lib/catissue/extract/extractor_test.rb +0 -43
- data/test/lib/catissue/import/importable_module_test.rb +0 -14
- data/test/lib/catissue/test_case.rb +0 -247
- data/test/lib/examples/galena/tissue/migration/annotation_test.rb +0 -29
- data/test/lib/examples/galena/tissue/migration/filter_test.rb +0 -29
- data/test/lib/examples/galena/tissue/migration/frozen_test.rb +0 -36
- data/test/lib/examples/galena/tissue/migration/general_test.rb +0 -56
- data/test/lib/examples/galena/tissue/migration/participant_test.rb +0 -61
- data/test/lib/examples/galena/tissue/migration/registration_test.rb +0 -17
- data/test/lib/examples/galena/tissue/migration/seedify.rb +0 -119
- data/test/lib/examples/galena/tissue/migration/simple_test.rb +0 -30
- data/test/lib/examples/galena/tissue/migration/test_case.rb +0 -72
- data/test/lib/examples/psbin/migration_test.rb +0 -153
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
2
|
|
3
3
|
class SpecimenRequirementTest < Test::Unit::TestCase
|
4
4
|
include CaTissue::TestCase
|
@@ -27,7 +27,7 @@ class SpecimenRequirementTest < Test::Unit::TestCase
|
|
27
27
|
@rqmt.derive(:count => 2, :specimen_type => (@rqmt.specimen_type + ' Block'))
|
28
28
|
assert_equal(2, @rqmt.children.size, "Derived requirement count incorrect")
|
29
29
|
@rqmt.add_defaults
|
30
|
-
assert_raise(ValidationError, "Multiple derivatives incorrectly succeeds validation") { @rqmt.validate }
|
30
|
+
assert_raise(Jinx::ValidationError, "Multiple derivatives incorrectly succeeds validation") { @rqmt.validate }
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_save
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require File.
|
2
|
-
require '
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
|
+
require 'jinx/helpers/transitive_closure'
|
3
3
|
|
4
4
|
class SpecimenTest < Test::Unit::TestCase
|
5
5
|
include CaTissue::TestCase
|
@@ -11,8 +11,8 @@ class SpecimenTest < Test::Unit::TestCase
|
|
11
11
|
|
12
12
|
def test_requirement_copy
|
13
13
|
rqmt = @spc.requirement
|
14
|
-
rqmt.value_hash(rqmt.class.nondomain_attributes).each do |
|
15
|
-
assert_equal(value, @spc.send(
|
14
|
+
rqmt.value_hash(rqmt.class.nondomain_attributes).each do |pa, value|
|
15
|
+
assert_equal(value, @spc.send(pa), "Specimen requirement #{pa} not copied")
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -133,7 +133,7 @@ class SpecimenTest < Test::Unit::TestCase
|
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
136
|
-
# Tests whether a
|
136
|
+
# Tests whether a specimen with a position save template does not include the position.
|
137
137
|
# The position is saved as a caTissue side-effect by creating a proxy transfer event.
|
138
138
|
def test_position_save_template
|
139
139
|
defaults.box << @spc
|
@@ -143,7 +143,7 @@ class SpecimenTest < Test::Unit::TestCase
|
|
143
143
|
assert_nil(tmpl.position, "#{@spc.qp} save template incorrectly includes the position")
|
144
144
|
end
|
145
145
|
|
146
|
-
def
|
146
|
+
def test_prostate_annotation
|
147
147
|
pst = CaTissue::Specimen::Pathology::ProstateSpecimenPathologyAnnotation.new
|
148
148
|
pst.merge_attributes(:specimen => @spc)
|
149
149
|
grade = CaTissue::Specimen::Pathology::SpecimenHistologicGrade.new
|
@@ -162,10 +162,9 @@ class SpecimenTest < Test::Unit::TestCase
|
|
162
162
|
assert_same(htype, pst.histologic_types.first, "Prostate annotation histologic types incorrect")
|
163
163
|
end
|
164
164
|
|
165
|
-
# Verifies that caRuby Tissue is compatible with both the caTissue 1.1 and 1.2 Specimen annotation class names.
|
165
|
+
# Verifies that caRuby Tissue is compatible with both the caTissue 1.1.2 and 1.2 Specimen annotation class names.
|
166
166
|
def test_rename
|
167
167
|
assert_same(CaTissue::Specimen::Pathology::SpecimenAdditionalFinding, CaTissue::Specimen::Pathology::AdditionalFinding, "caTissue 1.2 annotation class rename unsupported")
|
168
|
-
assert_same(CaTissue::Specimen::Pathology::SpecimenBaseSolidTissuePathologyAnnotation, CaTissue::Specimen::Pathology::SpecimenBaseSolidTissuePathologyAnnotation, "caTissue 1.2 annotation class rename unsupported")
|
169
168
|
assert_same(CaTissue::Specimen::Pathology::SpecimenDetails, CaTissue::Specimen::Pathology::Details, "caTissue 1.2 annotation class rename unsupported")
|
170
169
|
assert_same(CaTissue::Specimen::Pathology::ProstateSpecimenGleasonScore, CaTissue::Specimen::Pathology::GleasonScore, "caTissue 1.2 annotation class rename unsupported")
|
171
170
|
assert_same(CaTissue::Specimen::Pathology::SpecimenHistologicGrade, CaTissue::Specimen::Pathology::HistologicGrade, "caTissue 1.2 annotation class rename unsupported")
|
@@ -213,21 +212,51 @@ class SpecimenTest < Test::Unit::TestCase
|
|
213
212
|
assert_equal(changed, chr.tissue_site, "#{@spc} #{chr} tissue site not updated")
|
214
213
|
end
|
215
214
|
|
216
|
-
def
|
215
|
+
def test_nondisposal_specimen_event_save
|
217
216
|
# add an event
|
218
217
|
ev = CaTissue::SpunEventParameters.new(:specimen => @spc, :duration_in_minutes => 2, :gravity_force => 5)
|
219
218
|
verify_save(@spc)
|
220
219
|
assert_not_nil(ev.identifier, "#{@spc} event #{ev} not saved")
|
220
|
+
# make a nonanticipatory specimen
|
221
|
+
spc2 = CaTissue::Specimen.create_specimen(
|
222
|
+
:requirement => defaults.specimen_requirement,
|
223
|
+
:specimen_collection_group => defaults.specimen_collection_group,
|
224
|
+
:initial_quantity => 2.0)
|
225
|
+
# add an event to the nonanticipatory specimen
|
226
|
+
ev2 = CaTissue::SpunEventParameters.new(:specimen => spc2, :duration_in_minutes => 1, :gravity_force => 3)
|
227
|
+
# Save the new specimen
|
228
|
+
verify_save(spc2)
|
229
|
+
assert_not_nil(ev.identifier, "#{spc2} event #{ev2} not saved")
|
221
230
|
end
|
222
231
|
|
223
|
-
#
|
232
|
+
# Verifies the caRuby Bug #9, #10 and #11 fixes.
|
233
|
+
def test_disposal_event_save
|
234
|
+
# add an event to the anticipatory specimen
|
235
|
+
ev = CaTissue::DisposalEventParameters.new(:specimen => @spc)
|
236
|
+
# Save the specimen, which will update the anticipatory specimen
|
237
|
+
verify_save(@spc)
|
238
|
+
assert_not_nil(ev.identifier, "#{@spc} event #{ev} not saved")
|
239
|
+
assert_equal('Closed', @spc.activity_status, "Disposed #{@spc} is not closed")
|
240
|
+
# Make a nonanticipatory specimen.
|
241
|
+
spc2 = CaTissue::Specimen.create_specimen(
|
242
|
+
:requirement => defaults.specimen_requirement,
|
243
|
+
:specimen_collection_group => defaults.specimen_collection_group,
|
244
|
+
:initial_quantity => 2.0)
|
245
|
+
# Dispose the nonanticipatory specimen.
|
246
|
+
ev2 = CaTissue::DisposalEventParameters.new(:specimen => spc2)
|
247
|
+
# Save the new disposed specimen.
|
248
|
+
verify_save(spc2)
|
249
|
+
assert_not_nil(ev2.identifier, "#{spc2} event #{ev2} not saved")
|
250
|
+
end
|
251
|
+
|
252
|
+
# Verifies the work-around for caTissue Bug #159: Update pending Specimen ignores availableQuantity.
|
224
253
|
def test_quantity_save
|
225
254
|
# reset the available quantity
|
226
255
|
@spc.available_quantity = @spc.initial_quantity / 2
|
227
256
|
verify_save(@spc)
|
228
257
|
end
|
229
258
|
|
230
|
-
#
|
259
|
+
# Verifies the CaTissue::Specimen external_identifiers logical dependency work-around.
|
231
260
|
def test_eid_save
|
232
261
|
verify_save(@spc)
|
233
262
|
# add an EID
|
@@ -255,12 +284,6 @@ class SpecimenTest < Test::Unit::TestCase
|
|
255
284
|
logger.debug { "#{self} updating second EID specimen #{spc2}..." }
|
256
285
|
verify_save(spc2)
|
257
286
|
end
|
258
|
-
|
259
|
-
def test_events_save
|
260
|
-
# add an event
|
261
|
-
CaTissue::FrozenEventParameters.new(:specimen => @spc, :freeze_method => 'Cryostat')
|
262
|
-
verify_save(@spc)
|
263
|
-
end
|
264
287
|
|
265
288
|
def test_position_save
|
266
289
|
defaults.box << @spc
|
@@ -271,13 +294,12 @@ class SpecimenTest < Test::Unit::TestCase
|
|
271
294
|
verify_save(@spc)
|
272
295
|
end
|
273
296
|
|
274
|
-
#
|
297
|
+
# Exercises creation of a child specimen.
|
275
298
|
def test_derived_create
|
276
|
-
# verify creating a derived specimen
|
277
|
-
logger.debug { "Verifying creating a derived specimen..." }
|
278
299
|
# derive a specimen
|
279
300
|
drv = @spc.derive(:specimen_class => :molecular, :initial_quantity => 20, :specimen_type => 'DNA')
|
280
|
-
#
|
301
|
+
logger.debug { "#{name} verifying creation of derived specimen #{@spc}..." }
|
302
|
+
# save the derived specimen
|
281
303
|
verify_save(drv)
|
282
304
|
# verify the derived specimen parent
|
283
305
|
assert_same(@spc, drv.parent, "Derived specimen parent incorrect after store")
|
@@ -288,8 +310,20 @@ class SpecimenTest < Test::Unit::TestCase
|
|
288
310
|
assert(drv.match_in_owner_scope(children), "Derived specimen not found in parent query result")
|
289
311
|
end
|
290
312
|
end
|
313
|
+
|
314
|
+
# Exercises aliquot creation.
|
315
|
+
def test_aliquot_create
|
316
|
+
# make the aliquots
|
317
|
+
alqs = @spc.derive(:count => 2)
|
318
|
+
# save the specimens
|
319
|
+
verify_save(@spc)
|
320
|
+
# verify that each aliquot was created
|
321
|
+
alqs.each do |alq|
|
322
|
+
assert_not_nil(alq.identifier, "#{@spc} aliquot #{alq} not saved")
|
323
|
+
end
|
324
|
+
end
|
291
325
|
|
292
|
-
#
|
326
|
+
# Exercises update of an auto-generated child specimen.
|
293
327
|
#
|
294
328
|
# This test case differs from {#test_derived_create} in that there are critical caTissue code path
|
295
329
|
# differences which dictate how the derived object save template is built. See the caTissue
|
@@ -305,7 +339,7 @@ class SpecimenTest < Test::Unit::TestCase
|
|
305
339
|
verify_save(drv)
|
306
340
|
end
|
307
341
|
|
308
|
-
def
|
342
|
+
def test_prostate_annotation_save
|
309
343
|
pa = CaTissue::Specimen::Pathology::ProstateSpecimenPathologyAnnotation.new
|
310
344
|
pa.specimen = @spc
|
311
345
|
grade = CaTissue::Specimen::Pathology::SpecimenHistologicGrade.new
|
@@ -324,7 +358,7 @@ class SpecimenTest < Test::Unit::TestCase
|
|
324
358
|
assert_not_nil(gleason.identifier, "#{gleason} not saved")
|
325
359
|
end
|
326
360
|
|
327
|
-
def
|
361
|
+
def test_melanoma_annotation_save
|
328
362
|
ma = CaTissue::Specimen::Pathology::MelanomaSpecimenPathologyAnnotation.new
|
329
363
|
ma.merge_attributes(:specimen => @spc, :comments => "Test Comment", :depth_of_invasion => 2.0, :mitotic_index => "Less than 1 mitotic figure per mm-square",
|
330
364
|
:ulceration => "Absent", :tumor_regression => "Present involving 75% or more of lesion", :tumor_infiltrating_lymphocytes => "Brisk")
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require File.
|
2
|
-
require '
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
|
+
require 'jinx/helpers/uniquifier'
|
3
3
|
|
4
4
|
class StorageContainerTest < Test::Unit::TestCase
|
5
5
|
include CaTissue::TestCase
|
@@ -104,19 +104,6 @@ class StorageContainerTest < Test::Unit::TestCase
|
|
104
104
|
assert(@frz.completely_full?, "Freezer incorrectly not completely full")
|
105
105
|
end
|
106
106
|
|
107
|
-
def test_comparison
|
108
|
-
@frz << @spc
|
109
|
-
assert_equal(@frz, @frz, "Same not equal")
|
110
|
-
rack = @frz.subcontainers.first
|
111
|
-
assert_not_nil(rack, "Rack missing")
|
112
|
-
box = rack.subcontainers.first
|
113
|
-
assert_not_nil(box, "Box missing")
|
114
|
-
assert(rack < @frz, "Rack not < freezer")
|
115
|
-
assert(@frz > rack, "Freezer not > rack")
|
116
|
-
assert(box < rack, "Box not < rack")
|
117
|
-
assert(box < @frz, "Box not < rack")
|
118
|
-
end
|
119
|
-
|
120
107
|
def test_save
|
121
108
|
@frz << @spc
|
122
109
|
rack = @frz.subcontainers.first
|
@@ -148,4 +135,4 @@ class StorageContainerTest < Test::Unit::TestCase
|
|
148
135
|
assert_not_nil(@spc.identifier, "#{@spc} not saved")
|
149
136
|
assert_not_nil(@spc.position, "#{@spc} missing position")
|
150
137
|
end
|
151
|
-
end
|
138
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require File.
|
2
|
-
require '
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
|
+
require 'jinx/helpers/uniquifier'
|
3
3
|
|
4
4
|
class StorageTypeTest < Test::Unit::TestCase
|
5
5
|
include CaTissue::TestCase
|
@@ -66,4 +66,4 @@ class StorageTypeTest < Test::Unit::TestCase
|
|
66
66
|
stored = @box_type.find_containers.map { |ctr| ctr.identifier}
|
67
67
|
assert_equal([box.identifier], stored, "Box with identifier #{box.identifier} not found")
|
68
68
|
end
|
69
|
-
end
|
69
|
+
end
|
@@ -1,5 +1,4 @@
|
|
1
|
-
require File.
|
2
|
-
require 'caruby/database/store_template_builder'
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
3
2
|
|
4
3
|
class TransferEventParametersTest < Test::Unit::TestCase
|
5
4
|
include CaTissue::TestCase
|
@@ -14,26 +13,27 @@ class TransferEventParametersTest < Test::Unit::TestCase
|
|
14
13
|
def test_defaults
|
15
14
|
verify_defaults(@xfr)
|
16
15
|
end
|
16
|
+
|
17
|
+
def test_match
|
18
|
+
other = @xfr.copy
|
19
|
+
assert(!@xfr.matches?(other), "#{other} incorrectly matches #{@xfr}")
|
20
|
+
end
|
17
21
|
|
18
22
|
def test_inverse_setter
|
19
|
-
assert(@xfr.specimen.event_parameters.include?(@xfr), "
|
23
|
+
assert(@xfr.specimen.event_parameters.include?(@xfr), "#{@xfr} not found in specimen")
|
20
24
|
end
|
21
25
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
logger.debug { "#{self} testing #{xfr.specimen} move from #{xfr.from.coordinate.qp} to #{xfr.to.coordinate.qp}." }
|
27
|
-
verify_save(@xfr)
|
26
|
+
def test_move
|
27
|
+
prev = @xfr.to
|
28
|
+
@xfr.to = prev.succ
|
29
|
+
assert_equal(prev.column + 1, @xfr.to.column, "#{@xfr} position not incremented")
|
28
30
|
end
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
xfr.to = xfr.from.succ
|
37
|
-
xfr.identifier = nil
|
32
|
+
def test_save
|
33
|
+
logger.debug { "#{self} testing #{@xfr.specimen} storage at #{@xfr.to.coordinate.qp}." }
|
34
|
+
verify_save(@xfr)
|
35
|
+
moved = CaTissue::TransferEventParameters.new(:specimen => @xfr.specimen, :from => @xfr.to, :to => @xfr.to.succ)
|
36
|
+
logger.debug { "#{self} testing #{@xfr.specimen} move from #{moved.from.coordinate.qp} to #{moved.to.coordinate.qp}." }
|
37
|
+
verify_save(moved)
|
38
38
|
end
|
39
39
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
2
|
|
3
3
|
class UserTest < Test::Unit::TestCase
|
4
4
|
include CaTissue::TestCase
|
@@ -8,42 +8,40 @@ class UserTest < Test::Unit::TestCase
|
|
8
8
|
@user = defaults.tissue_bank.coordinator
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
#
|
20
|
-
# # Exercises setting the login name from the email address.
|
21
|
-
# def test_default_login_value
|
22
|
-
# @user.login_name = nil
|
23
|
-
# verify_defaults
|
24
|
-
# end
|
25
|
-
#
|
26
|
-
# # Exercises setting the email address from the login name.
|
27
|
-
# def test_default_email_value
|
28
|
-
# @user.email_address = nil
|
29
|
-
# verify_defaults
|
30
|
-
# end
|
31
|
-
#
|
32
|
-
# def verify_defaults
|
33
|
-
# @user.address.identifier = 1
|
34
|
-
# @user.cancer_research_group.identifier = 2
|
35
|
-
# @user.department.identifier = 3
|
36
|
-
# @user.institution.identifier = 4
|
37
|
-
# super(@user)
|
38
|
-
# end
|
11
|
+
# Verifies the secondary key.
|
12
|
+
def test_secondary_key
|
13
|
+
assert_equal(@user.login_name, @user.key, 'Key incorrect')
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_defaults
|
17
|
+
verify_defaults(@user)
|
18
|
+
end
|
39
19
|
|
40
|
-
#
|
20
|
+
# Exercises setting the login name from the email address.
|
21
|
+
def test_default_login_value
|
22
|
+
@user.login_name = nil
|
23
|
+
verify_defaults(@user)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Exercises setting the email address from the login name.
|
27
|
+
def test_default_email_value
|
28
|
+
@user.email_address = nil
|
29
|
+
verify_defaults(@user)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Tests creating a user and updating the address.
|
41
33
|
def test_save
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
34
|
+
# Create the user with a unique email.
|
35
|
+
email = @user.email_address
|
36
|
+
at_ndx = email.index('@')
|
37
|
+
modifier = "_#{Jinx::Uniquifier.qualifier}"
|
38
|
+
@user.email_address = email.insert(at_ndx, modifier)
|
46
39
|
@user.login_name = nil
|
47
40
|
verify_save(@user)
|
41
|
+
|
42
|
+
# Update the address.
|
43
|
+
logger.debug { "#{self} updating the #{@user} address..." }
|
44
|
+
@user.address.street = "#{Jinx::Uniquifier.qualifier} Elm St."
|
45
|
+
verify_save(@user)
|
48
46
|
end
|
49
47
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../helpers/test_case'
|
2
|
+
|
3
|
+
# This class verifies that the classpath property is loaded or inferred.
|
4
|
+
# Manually verify that the classpath is inferred by removing the
|
5
|
+
# +~/.catissue+ file and setting the +CATISSUE_CLIENT_HOME+ env var.
|
6
|
+
class PropertiesLoaderTest < Test::Unit::TestCase
|
7
|
+
def setup
|
8
|
+
# the path before loading caTissue
|
9
|
+
before = $CLASSPATH.to_s
|
10
|
+
# Induce application property load by referencing the properties.
|
11
|
+
CaTissue::Specimen
|
12
|
+
# the difference between the path before and after loading caTissue
|
13
|
+
@path = $CLASSPATH.to_s[before.length..-1]
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_path
|
17
|
+
assert_not_nil(@path, "path property was not loaded")
|
18
|
+
end
|
19
|
+
end
|
@@ -1,7 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require File.join(File.dirname(__FILE__), '..', 'test_case')
|
4
|
-
require 'caruby/domain/uniquify'
|
1
|
+
require File.dirname(__FILE__) + '/../../../../helpers/test_case'
|
2
|
+
require 'jinx/helpers/uniquifier'
|
5
3
|
require 'catissue/migration/migrator'
|
6
4
|
|
7
5
|
module CaTissue
|
@@ -10,23 +8,29 @@ module CaTissue
|
|
10
8
|
|
11
9
|
#@param [String] fixtures the fixtures directory
|
12
10
|
def setup(fixtures)
|
11
|
+
super()
|
13
12
|
@fixtures = fixtures
|
14
13
|
# Clear the uniquifier for this migration.
|
15
|
-
|
14
|
+
Jinx::Uniquifier.instance.clear
|
16
15
|
end
|
17
16
|
|
18
|
-
## MIGRATION TEST UTILITY METHODS ##
|
19
|
-
|
20
17
|
private
|
21
18
|
|
19
|
+
# @group Migration test utility methods
|
20
|
+
|
22
21
|
# Runs a migrator on the given input fixture and options.
|
23
22
|
#
|
24
23
|
# @param (see #create_migrator)
|
25
24
|
# @option (see #create_migrator)
|
26
|
-
|
25
|
+
# @yield [obj] verify the migration
|
26
|
+
# @yieldparam [Resource] obj the migrated object
|
27
|
+
def migrate_to_database(fixture, opts={})
|
27
28
|
mgtr = create_migrator(fixture, opts)
|
28
29
|
logger.debug { "Migration test migrating #{fixture} fixture..." }
|
29
|
-
mgtr.migrate_to_database
|
30
|
+
mgtr.migrate_to_database do |tgt, rec|
|
31
|
+
@post_pcsr.call(tgt) if @post_pcsr
|
32
|
+
yield tgt if block_given?
|
33
|
+
end
|
30
34
|
logger.debug { "Migration test migrated #{fixture} fixture." }
|
31
35
|
end
|
32
36
|
|
@@ -34,24 +38,26 @@ module CaTissue
|
|
34
38
|
# If a factory block is provided, then that factory is called to make a new
|
35
39
|
# Migrator instance. Otherwise, {CaTissue::Migrator#initialize} makes the instance.
|
36
40
|
#
|
37
|
-
# If there is no
|
41
|
+
# If there is no +:input+ option, then the migration input is set to the
|
38
42
|
# _fixture_.+csv+ file in the {#initialize} fixtures directory.
|
39
43
|
#
|
40
44
|
# @param [Symbol] fixture the migration test fixture
|
41
45
|
# @param [{Symbol => Object}] opts (see CaTissue::Migrator#initialize)
|
42
46
|
# @option (see CaTissue::Migrator#initialize)
|
47
|
+
# @yield [obj] post-process the migrated object
|
48
|
+
# @yieldparam [Resource] obj the migrated object
|
43
49
|
# @return [CaTissue::Migrator]
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
50
|
+
def create_migrator(fixture, opts={}, &block)
|
51
|
+
opts[:input] ||= File.expand_path("#{fixture}.csv", @fixtures)
|
52
|
+
@post_pcsr = block if block_given?
|
53
|
+
CaTissue::Migrator.new(opts)
|
48
54
|
end
|
49
55
|
|
50
56
|
# Verifies that the given test fixture is successfully migrated.
|
51
57
|
# Each migrated target object is validated using {CaTissue::TestCase#verify_saved}.
|
52
58
|
# In addition, if a verifier block is given to this method, then that block is
|
53
59
|
# called on the target migration object, or nil if no target was migrated.
|
54
|
-
# Supported options are described in
|
60
|
+
# Supported options are described in +Jinx::Migrator.migrate+.
|
55
61
|
#
|
56
62
|
# @param (see #verify_target)
|
57
63
|
# @option (see #verify_target)
|
@@ -60,8 +66,8 @@ module CaTissue
|
|
60
66
|
def verify_save(fixture, opts={})
|
61
67
|
logger.debug { "Migrating the #{fixture} test fixture..." }
|
62
68
|
opts[:unique] = true unless opts.has_key?(:unique)
|
63
|
-
opts
|
64
|
-
|
69
|
+
migrate_to_database(fixture, opts) do |tgt, rec|
|
70
|
+
@post_pcsr.call(tgt) if @post_pcsr
|
65
71
|
verify_saved(tgt)
|
66
72
|
yield tgt if block_given?
|
67
73
|
end
|
@@ -70,6 +76,7 @@ module CaTissue
|
|
70
76
|
# Verifies the given fixture migration.
|
71
77
|
# Each migrated target object is validated using {#validate_target}.
|
72
78
|
# The target is migrated but not stored.
|
79
|
+
# The +:unique+ option is set to false by default.
|
73
80
|
#
|
74
81
|
# @param [Symbol] fixture the test fixture to verify
|
75
82
|
# @param [<Symbol>] opts the migration options
|
@@ -78,7 +85,10 @@ module CaTissue
|
|
78
85
|
# @yieldparam [Resource] target the domain object to verify
|
79
86
|
def verify_target(fixture, opts={}, &verifier)
|
80
87
|
opts[:unique] ||= false
|
81
|
-
create_migrator(fixture, opts).migrate
|
88
|
+
create_migrator(fixture, opts).migrate do |tgt, rec|
|
89
|
+
@post_pcsr.call(tgt) if @post_pcsr
|
90
|
+
validate_target(tgt, &verifier)
|
91
|
+
end
|
82
92
|
end
|
83
93
|
|
84
94
|
# Validates that the given target was successfully migrated.
|
@@ -93,10 +103,10 @@ module CaTissue
|
|
93
103
|
def validate_target(target)
|
94
104
|
assert_not_nil(target, "Missing target")
|
95
105
|
logger.debug { "Validating migration target #{target}..." }
|
96
|
-
verify_defaults(target)
|
106
|
+
verify_defaults(target) unless target.identifier
|
97
107
|
yield target if block_given?
|
98
108
|
logger.debug { "Validated migration target #{target}." }
|
99
109
|
target
|
100
110
|
end
|
101
111
|
end
|
102
|
-
end
|
112
|
+
end
|