caruby-core 1.4.7 → 1.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +11 -0
- data/README.md +1 -1
- data/lib/caruby/cli/command.rb +27 -3
- data/lib/caruby/csv/csv_mapper.rb +2 -0
- data/lib/caruby/csv/csvio.rb +187 -169
- data/lib/caruby/database.rb +33 -16
- data/lib/caruby/database/lazy_loader.rb +23 -23
- data/lib/caruby/database/persistable.rb +32 -18
- data/lib/caruby/database/persistence_service.rb +20 -7
- data/lib/caruby/database/reader.rb +22 -21
- data/lib/caruby/database/search_template_builder.rb +7 -9
- data/lib/caruby/database/sql_executor.rb +52 -27
- data/lib/caruby/database/store_template_builder.rb +18 -13
- data/lib/caruby/database/writer.rb +107 -44
- data/lib/caruby/domain/attribute_metadata.rb +35 -25
- data/lib/caruby/domain/java_attribute_metadata.rb +43 -20
- data/lib/caruby/domain/merge.rb +9 -5
- data/lib/caruby/domain/reference_visitor.rb +4 -3
- data/lib/caruby/domain/resource_attributes.rb +52 -12
- data/lib/caruby/domain/resource_dependency.rb +129 -42
- data/lib/caruby/domain/resource_introspection.rb +1 -1
- data/lib/caruby/domain/resource_inverse.rb +20 -3
- data/lib/caruby/domain/resource_metadata.rb +20 -4
- data/lib/caruby/domain/resource_module.rb +190 -124
- data/lib/caruby/import/java.rb +39 -19
- data/lib/caruby/migration/migratable.rb +31 -6
- data/lib/caruby/migration/migrator.rb +126 -40
- data/lib/caruby/migration/uniquify.rb +0 -1
- data/lib/caruby/resource.rb +28 -5
- data/lib/caruby/util/attribute_path.rb +0 -2
- data/lib/caruby/util/class.rb +8 -5
- data/lib/caruby/util/collection.rb +5 -3
- data/lib/caruby/util/domain_extent.rb +0 -3
- data/lib/caruby/util/options.rb +10 -9
- data/lib/caruby/util/person.rb +41 -12
- data/lib/caruby/util/pretty_print.rb +1 -1
- data/lib/caruby/util/validation.rb +0 -28
- data/lib/caruby/version.rb +1 -1
- data/test/lib/caruby/import/java_test.rb +26 -9
- data/test/lib/caruby/migration/test_case.rb +103 -0
- data/test/lib/caruby/test_case.rb +231 -0
- data/test/lib/caruby/util/class_test.rb +2 -2
- data/test/lib/caruby/util/visitor_test.rb +3 -2
- data/test/lib/examples/galena/clinical_trials/migration/participant_test.rb +28 -0
- data/test/lib/examples/galena/clinical_trials/migration/test_case.rb +40 -0
- metadata +195 -170
- data/lib/caruby/domain/attribute_initializer.rb +0 -16
- data/test/lib/caruby/util/validation_test.rb +0 -14
| @@ -0,0 +1,231 @@ | |
| 1 | 
            +
            $:.unshift  '../caruby/lib'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # open the logger
         | 
| 4 | 
            +
            LOG_FILE = 'test/results/log/catissue.log' unless defined?(LOG_FILE)
         | 
| 5 | 
            +
            require 'caruby/util/log' and
         | 
| 6 | 
            +
              CaRuby::Log.instance.open(LOG_FILE, :shift_age => 10, :shift_size => 1048576, :debug => true)
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            require 'caruby'
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            module CaRuby
         | 
| 11 | 
            +
              module TestCase
         | 
| 12 | 
            +
                attr_reader :database
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                def setup(database=nil)
         | 
| 15 | 
            +
                  super()
         | 
| 16 | 
            +
                  logger.info("Testing #{name}...")
         | 
| 17 | 
            +
                  @database = database
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                def teardown
         | 
| 21 | 
            +
                  super
         | 
| 22 | 
            +
                  @database.close if @database
         | 
| 23 | 
            +
                  logger.info("Test #{name} completed.")
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
                
         | 
| 26 | 
            +
                def defaults
         | 
| 27 | 
            +
                  @defaults ||= CaTissueTest.defaults.uniquify
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
                
         | 
| 30 | 
            +
                # Tests the domain object +add_defaults_local+ method.
         | 
| 31 | 
            +
                # Subclasses are responsible for setting every attribute that is a pre-condition for default value initialization.
         | 
| 32 | 
            +
                def verify_defaults(subject)
         | 
| 33 | 
            +
                  subject.add_defaults
         | 
| 34 | 
            +
                  msg = "#{subject.qp} with default attributes fails validation"
         | 
| 35 | 
            +
                  assert_nothing_raised(ValidationError, msg) { subject.validate }
         | 
| 36 | 
            +
                end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                # Tests saving the subject. Calls {Database#save} on the subject and verifies that subject and its
         | 
| 39 | 
            +
                # references were persisted.
         | 
| 40 | 
            +
                #
         | 
| 41 | 
            +
                # @param [Resource] subject the object to save
         | 
| 42 | 
            +
                def verify_save(subject)
         | 
| 43 | 
            +
                  logger.debug{ "Verifying #{subject.qp} save with content:\n#{dump(subject)}" }
         | 
| 44 | 
            +
                  # capture the save operation time
         | 
| 45 | 
            +
                  @database.clear
         | 
| 46 | 
            +
                  st = Stopwatch.measure { @database.open { |db| db.save(subject) } }.elapsed
         | 
| 47 | 
            +
                  # the database execution time
         | 
| 48 | 
            +
                  dt = @database.execution_time
         | 
| 49 | 
            +
                  logger.debug { "#{subject.qp} save took #{'%.2f' % st} seconds, of which #{'%.2f' % dt} were database operations." }
         | 
| 50 | 
            +
                  verify_saved(subject)
         | 
| 51 | 
            +
                end
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                # Verifies that the given subject and its references were persisted.
         | 
| 54 | 
            +
                #
         | 
| 55 | 
            +
                # @param [Resource] subject the saved object to verify
         | 
| 56 | 
            +
                def verify_saved(subject)
         | 
| 57 | 
            +
                  logger.debug { "Verifying saved content of #{subject}..." }
         | 
| 58 | 
            +
                  subject.dependent? ? verify_saved_dependent(subject) : verify_saved_independent(subject)
         | 
| 59 | 
            +
                  logger.debug { "Verified saved content of #{subject}." }
         | 
| 60 | 
            +
                end
         | 
| 61 | 
            +
                
         | 
| 62 | 
            +
                # Tests a query on the given template.
         | 
| 63 | 
            +
                # The block given to this method is called on the query result.
         | 
| 64 | 
            +
                def verify_query(template, *path) # :yields: result
         | 
| 65 | 
            +
                  yield database.query(template, *path)
         | 
| 66 | 
            +
                end
         | 
| 67 | 
            +
             | 
| 68 | 
            +
                # Returns the Ruby date as determined by setting a Java Date property.
         | 
| 69 | 
            +
                def date(year, month, day)
         | 
| 70 | 
            +
                  jdate = java.util.Calendar.instance
         | 
| 71 | 
            +
                  jdate.clear
         | 
| 72 | 
            +
                  jdate.set(year, month - 1, day)
         | 
| 73 | 
            +
                  jdate.time.to_ruby_date
         | 
| 74 | 
            +
                end
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                private
         | 
| 77 | 
            +
                
         | 
| 78 | 
            +
                def dump(obj)
         | 
| 79 | 
            +
                  @database.lazy_loader.suspend { obj.dump }
         | 
| 80 | 
            +
                end
         | 
| 81 | 
            +
              
         | 
| 82 | 
            +
                # @param (see #mock_storable_template)
         | 
| 83 | 
            +
                # @return (see #mock_storable_template)
         | 
| 84 | 
            +
                def mock_create_template(obj)
         | 
| 85 | 
            +
                  mock_storable_template(obj) { |ref| ref.class.creatable_domain_attributes }
         | 
| 86 | 
            +
                end
         | 
| 87 | 
            +
              
         | 
| 88 | 
            +
                # @param (see #mock_storable_template)
         | 
| 89 | 
            +
                # @return (see #mock_storable_template)
         | 
| 90 | 
            +
                def mock_update_template(obj)
         | 
| 91 | 
            +
                  mock_storable_template(obj) { |ref| ref.class.updatable_domain_attributes }
         | 
| 92 | 
            +
                end
         | 
| 93 | 
            +
                
         | 
| 94 | 
            +
                # @param [Resource] obj the domain object to "save"
         | 
| 95 | 
            +
                # @return [Resource] the template to use in the save operation
         | 
| 96 | 
            +
                # @yield [ref] the storable attributes
         | 
| 97 | 
            +
                # @yieldparam [Resource] ref the domain object to "save"
         | 
| 98 | 
            +
                def mock_storable_template(obj, &selector)
         | 
| 99 | 
            +
                  # add fake identifiers to prerequisite references
         | 
| 100 | 
            +
                  obj.class.storable_prerequisite_attributes.each do |attr|
         | 
| 101 | 
            +
                    obj.send(attr).enumerate { |ref| ref.identifier = 1 }
         | 
| 102 | 
            +
                  end
         | 
| 103 | 
            +
                  # the template builder
         | 
| 104 | 
            +
                  bldr = CaRuby::StoreTemplateBuilder.new(@database, &selector)
         | 
| 105 | 
            +
                  # the save template
         | 
| 106 | 
            +
                  bldr.build_template(obj)
         | 
| 107 | 
            +
                end
         | 
| 108 | 
            +
             | 
| 109 | 
            +
                def verify_saved_dependent(dependent)
         | 
| 110 | 
            +
                  verify_dependency(dependent)
         | 
| 111 | 
            +
                  verify_saved_content(dependent)
         | 
| 112 | 
            +
                end
         | 
| 113 | 
            +
                
         | 
| 114 | 
            +
                def verify_dependency(dependent)
         | 
| 115 | 
            +
                  return if dependent.class.owner_attribute.nil?
         | 
| 116 | 
            +
                  # kludge for annotation proxy nonsense (cf. Annotation#owner)
         | 
| 117 | 
            +
                  ownr = Annotation === dependent ? (dependent.hook or dependent.owner) : dependent.owner
         | 
| 118 | 
            +
                  assert_not_nil(ownr, "Owner missing for dependent: #{dependent}")
         | 
| 119 | 
            +
                  attribute = ownr.class.dependent_attribute(dependent.class)
         | 
| 120 | 
            +
                  assert_not_nil(attribute, "Dependent attribute missing for #{dependent} owner #{ownr}")
         | 
| 121 | 
            +
                  # a dependent collection reference must be refetched
         | 
| 122 | 
            +
                  if ownr.class.collection_attribute?(attribute) then
         | 
| 123 | 
            +
                    verify_saved_dependent_collection_member(dependent, ownr, attribute)
         | 
| 124 | 
            +
                  else
         | 
| 125 | 
            +
                    assert_not_nil(dependent.identifier, "Stored dependent #{dependent} identifier is not set")
         | 
| 126 | 
            +
                  end
         | 
| 127 | 
            +
                end
         | 
| 128 | 
            +
             | 
| 129 | 
            +
                # Verifies that the given dependent has an identifier and that the given owner dependent attribute value
         | 
| 130 | 
            +
                # contains the dependent.
         | 
| 131 | 
            +
                #
         | 
| 132 | 
            +
                # JRuby alert - Set include? incorrectly returns false in the OHSU PSR samples_test test_save_grade
         | 
| 133 | 
            +
                # call to this method. Work around by using Set detect rather than include?.
         | 
| 134 | 
            +
                def verify_saved_dependent_collection_member(dependent, owner, attribute)
         | 
| 135 | 
            +
                  deps = owner.send(attribute)
         | 
| 136 | 
            +
                  assert(deps.detect { |dep| dep == dependent }, "Owner #{owner.qp} #{attribute} value #{deps.pp_s} does not contain #{dependent}")
         | 
| 137 | 
            +
                  assert_not_nil(dependent.identifier, "Identifier not set for stored owner #{owner.qp} #{attribute} dependent collection member #{dependent}")
         | 
| 138 | 
            +
                end
         | 
| 139 | 
            +
             | 
| 140 | 
            +
                # Verifies the subject stored content.
         | 
| 141 | 
            +
                def verify_saved_independent(subject)
         | 
| 142 | 
            +
                  subject_id = subject.identifier
         | 
| 143 | 
            +
                  assert_not_nil(subject_id, "#{subject.class.qp} identifier not set")
         | 
| 144 | 
            +
                  verify_saved_content(subject)
         | 
| 145 | 
            +
                end
         | 
| 146 | 
            +
             | 
| 147 | 
            +
                # Verifies that the given subject matches the database content. Does not verify subject unless it has
         | 
| 148 | 
            +
                # a secondary key.
         | 
| 149 | 
            +
                def verify_saved_content(subject)
         | 
| 150 | 
            +
                  attrs = subject.class.secondary_key_attributes
         | 
| 151 | 
            +
                  return if attrs.empty?
         | 
| 152 | 
            +
                  rqd = attrs & subject.class.mandatory_attributes
         | 
| 153 | 
            +
                  missing = rqd.reject { |attr| subject.send(attr) }
         | 
| 154 | 
            +
                  assert(missing.empty?, "#{subject} is missing values for secondary key attributes #{missing.to_series}")
         | 
| 155 | 
            +
                  # make a secondary key search template
         | 
| 156 | 
            +
                  vh = attrs.to_compact_hash do |attr|
         | 
| 157 | 
            +
                     v = subject.send(attr)
         | 
| 158 | 
            +
                     Resource === v ? v.copy : v
         | 
| 159 | 
            +
                  end
         | 
| 160 | 
            +
                  tmpl = subject.class.new(vh)
         | 
| 161 | 
            +
                  # find the template in the database
         | 
| 162 | 
            +
                  logger.debug  { "Verifying #{subject.qp} by finding and comparing template #{tmpl.pp_s}..." }
         | 
| 163 | 
            +
                  assert_not_nil(tmpl.find, "#{subject} not found in database")
         | 
| 164 | 
            +
                  # compare the subject to the fetched template
         | 
| 165 | 
            +
                  verify_that_saved_matches_fetched(subject, tmpl)
         | 
| 166 | 
            +
                end
         | 
| 167 | 
            +
             | 
| 168 | 
            +
                # Verifies that the given expected domain object has the same content as actual,
         | 
| 169 | 
            +
                # and that the dependents match.
         | 
| 170 | 
            +
                #
         | 
| 171 | 
            +
                # caTissue alert - caTissue mutilates an unspecified specimen type available quantity, e.g.
         | 
| 172 | 
            +
                # changing a Specimen with specimen type 'Not Specified' from available quantity 1, initial
         | 
| 173 | 
            +
                # quantity 1 to available quantity 0, initial quantity 3 results in available quantity 2
         | 
| 174 | 
            +
                # in database. The update is necessary when creating the Specimen with available quantity 0,
         | 
| 175 | 
            +
                # initial quantity 3 to work around a different caTissue bug. Thus, the bug work-around
         | 
| 176 | 
            +
                # is broken by a different caTissue bug.
         | 
| 177 | 
            +
                #
         | 
| 178 | 
            +
                # @param [Resource] expected the saved value
         | 
| 179 | 
            +
                # @param [Resource] actual the fetched value
         | 
| 180 | 
            +
                def verify_that_saved_matches_fetched(expected, actual)
         | 
| 181 | 
            +
                  expected.class.saved_nondomain_attributes.each do |attr|
         | 
| 182 | 
            +
                    # TODO - available_quantity broken for spc type Not Specified
         | 
| 183 | 
            +
                    # compare attributes that are fetched and set on create
         | 
| 184 | 
            +
                    attr_md = expected.class.attribute_metadata(attr)
         | 
| 185 | 
            +
                    if verify_saved_attribute?(attr_md) then
         | 
| 186 | 
            +
                      eval = expected.database.lazy_loader.suspend { expected.send(attr) }
         | 
| 187 | 
            +
                      next if eval.nil_or_empty?
         | 
| 188 | 
            +
                      aval = actual.send(attr)
         | 
| 189 | 
            +
                      if eval.nil? then
         | 
| 190 | 
            +
                        assert_nil(aval, "#{expected.qp} was saved without a #{attr} value, but was stored in the database with value #{actual.qp}")
         | 
| 191 | 
            +
                      else
         | 
| 192 | 
            +
                        assert_not_nil(aval, "#{expected.qp} was saved with #{attr} value #{eval.qp}, but this value was not found in the database.")
         | 
| 193 | 
            +
                        if attr == :available_quantity and expected.specimen_type == 'Not Specified' and eval != aval then
         | 
| 194 | 
            +
                          logger.warn("Skipped broken caTissue unspecified specimen type available comparison.")
         | 
| 195 | 
            +
                        else
         | 
| 196 | 
            +
                          assert(CaRuby::Resource.value_equal?(eval, aval), "#{expected.qp} was saved with #{attr} value #{eval.qp} that does not match the database value #{aval.qp}")
         | 
| 197 | 
            +
                        end
         | 
| 198 | 
            +
                      end
         | 
| 199 | 
            +
                    end
         | 
| 200 | 
            +
                  end
         | 
| 201 | 
            +
                  verify_dependents_match(expected, actual)
         | 
| 202 | 
            +
                end
         | 
| 203 | 
            +
                
         | 
| 204 | 
            +
                # @param [AttributeMetadata] attr_md the saved attribute to check
         | 
| 205 | 
            +
                # @return whether the attribute is fetched, creatable and not volatile
         | 
| 206 | 
            +
                def verify_saved_attribute?(attr_md)
         | 
| 207 | 
            +
                  attr_md.fetched? and attr_md.creatable? and not attr_md.volatile?
         | 
| 208 | 
            +
                end
         | 
| 209 | 
            +
             | 
| 210 | 
            +
                # Verifies that each expected dependent matches an actual dependent and has the same content.
         | 
| 211 | 
            +
                def verify_dependents_match(expected, actual)
         | 
| 212 | 
            +
                  expected.class.dependent_attributes.each do |attr|
         | 
| 213 | 
            +
                    edeps = expected.database.lazy_loader.suspend { expected.send(attr) }
         | 
| 214 | 
            +
                    next if edeps.nil_or_empty?
         | 
| 215 | 
            +
                    adeps = actual.send(attr)
         | 
| 216 | 
            +
                    logger.debug { "Verifying #{expected.qp} dependent #{attr} #{edeps.qp} against #{actual.qp} #{adeps.qp}..." } unless edeps.nil_or_empty?
         | 
| 217 | 
            +
                    if edeps.collection? then
         | 
| 218 | 
            +
                      edeps.each do |edep|
         | 
| 219 | 
            +
                        adep = edep.match_in_owner_scope(adeps)
         | 
| 220 | 
            +
                        assert_not_nil(adep, "#{expected} #{attr} dependent #{edep} not found in fetched #{adeps.pp_s}")
         | 
| 221 | 
            +
                        verify_that_saved_matches_fetched(edep, adep)
         | 
| 222 | 
            +
                      end
         | 
| 223 | 
            +
                    else
         | 
| 224 | 
            +
                      edep = edeps; adep = adeps;
         | 
| 225 | 
            +
                      assert_not_nil(adep, "#{expected} #{attr} dependent #{edep} not found in database")
         | 
| 226 | 
            +
                      verify_that_saved_matches_fetched(edep, adep)
         | 
| 227 | 
            +
                    end
         | 
| 228 | 
            +
                  end
         | 
| 229 | 
            +
                end
         | 
| 230 | 
            +
              end
         | 
| 231 | 
            +
            end
         | 
| @@ -24,8 +24,8 @@ class ClassTest < Test::Unit::TestCase | |
| 24 24 | 
             
              class Person
         | 
| 25 25 | 
             
                attr_reader :social_security_number
         | 
| 26 26 | 
             
                attr_accessor :postal_code
         | 
| 27 | 
            -
                 | 
| 28 | 
            -
                 | 
| 27 | 
            +
                alias_attribute(:ssn, :social_security_number)
         | 
| 28 | 
            +
                alias_attribute(:zip_code, :postal_code)
         | 
| 29 29 | 
             
              end
         | 
| 30 30 |  | 
| 31 31 | 
             
              def test_attribute_alias
         | 
| @@ -1,6 +1,7 @@ | |
| 1 1 | 
             
            $:.unshift 'lib'
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 3 | 
            +
            # JRuby alert - SyncEnumerator moved from generator to REXML in JRuby 1.5
         | 
| 4 | 
            +
            require 'rexml/document'
         | 
| 4 5 | 
             
            require "test/unit"
         | 
| 5 6 | 
             
            require 'caruby/util/collection'
         | 
| 6 7 | 
             
            require 'caruby/util/visitor'
         | 
| @@ -101,7 +102,7 @@ class VistorTest < Test::Unit::TestCase | |
| 101 102 | 
             
                child = Node.new(2, p1)
         | 
| 102 103 | 
             
                p2 = Node.new(3)
         | 
| 103 104 | 
             
                p2.children << child
         | 
| 104 | 
            -
                result = CaRuby::Visitor.new { |pair| SyncEnumerator.new(pair.first.children, pair.last.children).to_a }.to_enum([p1, p2]).map { |pair| [pair.first.value, pair.last.value] }
         | 
| 105 | 
            +
                result = CaRuby::Visitor.new { |pair| REXML::SyncEnumerator.new(pair.first.children, pair.last.children).to_a }.to_enum([p1, p2]).map { |pair| [pair.first.value, pair.last.value] }
         | 
| 105 106 | 
             
                assert_equal([[1, 3], [2, 2]], result.to_a, "Collection visit result incorrect")
         | 
| 106 107 | 
             
              end
         | 
| 107 108 |  | 
| @@ -0,0 +1,28 @@ | |
| 1 | 
            +
            require File.join(File.dirname(__FILE__), 'test_case')
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # Tests the ClinicalTrials example migration.
         | 
| 4 | 
            +
            module Galena
         | 
| 5 | 
            +
              module ClinicalTrials
         | 
| 6 | 
            +
                class ParticipantMigrationTest < Test::Unit::TestCase
         | 
| 7 | 
            +
                  include MigrationTestCase
         | 
| 8 | 
            +
                  
         | 
| 9 | 
            +
                  def test_target
         | 
| 10 | 
            +
                    verify_target(:participant, :target => ClinicalTrials::Participant) do |pnt|
         | 
| 11 | 
            +
                      assert_not_nil(pnt.ssn, "Missing SSN")
         | 
| 12 | 
            +
                    end
         | 
| 13 | 
            +
                  end
         | 
| 14 | 
            +
                  
         | 
| 15 | 
            +
                  def test_filter
         | 
| 16 | 
            +
                    verify_target(:participant, :target => ClinicalTrials::Participant, :input => FILTER_DATA, :shims => [FILTER_SHIMS]) do |pnt|
         | 
| 17 | 
            +
                      assert_not_nil(pnt.ssn, "Missing SSN")
         | 
| 18 | 
            +
                    end
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
                  
         | 
| 21 | 
            +
                  private
         | 
| 22 | 
            +
                  
         | 
| 23 | 
            +
                  FILTER_DATA = 'examples/galena/data/filter.csv'
         | 
| 24 | 
            +
                  
         | 
| 25 | 
            +
                  FILTER_SHIMS = 'examples/galena/lib/galena/migration/filter_shims.rb'
         | 
| 26 | 
            +
                end
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
            end
         | 
| @@ -0,0 +1,40 @@ | |
| 1 | 
            +
            $:.unshift 'examples/clinical_trials/lib'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'test/lib/caruby/migration/test_case'
         | 
| 4 | 
            +
            require 'clinical_trials'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            # Tests the ClinicalTrials example migration.
         | 
| 7 | 
            +
            module Galena
         | 
| 8 | 
            +
              module ClinicalTrials
         | 
| 9 | 
            +
                module MigrationTestCase
         | 
| 10 | 
            +
                  include CaRuby::MigrationTestCase
         | 
| 11 | 
            +
                  
         | 
| 12 | 
            +
                  # The migration input data directory.
         | 
| 13 | 
            +
                  FIXTURES = 'examples/galena/data'
         | 
| 14 | 
            +
                
         | 
| 15 | 
            +
                  # The migration input data directory.
         | 
| 16 | 
            +
                  SHIMS = 'examples/galena/lib/galena/migration'
         | 
| 17 | 
            +
                  
         | 
| 18 | 
            +
                  # The migration configuration directory.
         | 
| 19 | 
            +
                  CONFIGS = 'examples/galena/conf/migration'
         | 
| 20 | 
            +
                  
         | 
| 21 | 
            +
                  def setup
         | 
| 22 | 
            +
                    super(FIXTURES)
         | 
| 23 | 
            +
                  end
         | 
| 24 | 
            +
                  
         | 
| 25 | 
            +
                  # Adds the +:target+, +:mapping+ and +:shims+ to the options and delegates
         | 
| 26 | 
            +
                  # to the superclass.
         | 
| 27 | 
            +
                  #
         | 
| 28 | 
            +
                  # @see {CaTissue::MigrationTestCase#create_migrator}
         | 
| 29 | 
            +
                  def create_migrator(fixture, opts={})
         | 
| 30 | 
            +
                    opts[:mapping] ||= File.join(CONFIGS, "#{fixture}_fields.yaml")
         | 
| 31 | 
            +
                    shims = File.join(SHIMS, "#{fixture}_shims.rb")
         | 
| 32 | 
            +
                    if File.exists?(shims) then
         | 
| 33 | 
            +
                      sopt = opts[:shims] ||= []
         | 
| 34 | 
            +
                      sopt << shims
         | 
| 35 | 
            +
                    end
         | 
| 36 | 
            +
                    super
         | 
| 37 | 
            +
                  end
         | 
| 38 | 
            +
                end
         | 
| 39 | 
            +
              end
         | 
| 40 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,62 +1,79 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: caruby-core
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
               | 
| 5 | 
            -
               | 
| 4 | 
            +
              hash: 21
         | 
| 5 | 
            +
              prerelease: false
         | 
| 6 | 
            +
              segments: 
         | 
| 7 | 
            +
              - 1
         | 
| 8 | 
            +
              - 4
         | 
| 9 | 
            +
              - 9
         | 
| 10 | 
            +
              version: 1.4.9
         | 
| 6 11 | 
             
            platform: ruby
         | 
| 7 12 | 
             
            authors: 
         | 
| 8 | 
            -
             | 
| 13 | 
            +
            - OHSU
         | 
| 9 14 | 
             
            autorequire: 
         | 
| 10 15 | 
             
            bindir: bin
         | 
| 11 16 | 
             
            cert_chain: []
         | 
| 12 17 |  | 
| 13 | 
            -
            date: 2011- | 
| 18 | 
            +
            date: 2011-05-09 00:00:00 -07:00
         | 
| 14 19 | 
             
            default_executable: 
         | 
| 15 20 | 
             
            dependencies: 
         | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
                 | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
                 | 
| 49 | 
            -
             | 
| 50 | 
            -
                 | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
                     | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 21 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 22 | 
            +
              name: dbi
         | 
| 23 | 
            +
              prerelease: false
         | 
| 24 | 
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 25 | 
            +
                none: false
         | 
| 26 | 
            +
                requirements: 
         | 
| 27 | 
            +
                - - ">="
         | 
| 28 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 29 | 
            +
                    hash: 3
         | 
| 30 | 
            +
                    segments: 
         | 
| 31 | 
            +
                    - 0
         | 
| 32 | 
            +
                    version: "0"
         | 
| 33 | 
            +
              type: :runtime
         | 
| 34 | 
            +
              version_requirements: *id001
         | 
| 35 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 36 | 
            +
              name: dbd-jdbc
         | 
| 37 | 
            +
              prerelease: false
         | 
| 38 | 
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 39 | 
            +
                none: false
         | 
| 40 | 
            +
                requirements: 
         | 
| 41 | 
            +
                - - ">="
         | 
| 42 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 43 | 
            +
                    hash: 3
         | 
| 44 | 
            +
                    segments: 
         | 
| 45 | 
            +
                    - 0
         | 
| 46 | 
            +
                    version: "0"
         | 
| 47 | 
            +
              type: :runtime
         | 
| 48 | 
            +
              version_requirements: *id002
         | 
| 49 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 50 | 
            +
              name: fastercsv
         | 
| 51 | 
            +
              prerelease: false
         | 
| 52 | 
            +
              requirement: &id003 !ruby/object:Gem::Requirement 
         | 
| 53 | 
            +
                none: false
         | 
| 54 | 
            +
                requirements: 
         | 
| 55 | 
            +
                - - ">="
         | 
| 56 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 57 | 
            +
                    hash: 3
         | 
| 58 | 
            +
                    segments: 
         | 
| 59 | 
            +
                    - 0
         | 
| 60 | 
            +
                    version: "0"
         | 
| 61 | 
            +
              type: :runtime
         | 
| 62 | 
            +
              version_requirements: *id003
         | 
| 63 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 64 | 
            +
              name: uom
         | 
| 65 | 
            +
              prerelease: false
         | 
| 66 | 
            +
              requirement: &id004 !ruby/object:Gem::Requirement 
         | 
| 67 | 
            +
                none: false
         | 
| 68 | 
            +
                requirements: 
         | 
| 69 | 
            +
                - - ">="
         | 
| 70 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 71 | 
            +
                    hash: 3
         | 
| 72 | 
            +
                    segments: 
         | 
| 73 | 
            +
                    - 0
         | 
| 74 | 
            +
                    version: "0"
         | 
| 75 | 
            +
              type: :runtime
         | 
| 76 | 
            +
              version_requirements: *id004
         | 
| 60 77 | 
             
            description: "    caRuby is a JRuby facade for interaction with caBIG applications.\n"
         | 
| 61 78 | 
             
            email: caruby.org@gmail.com
         | 
| 62 79 | 
             
            executables: []
         | 
| @@ -66,142 +83,150 @@ extensions: [] | |
| 66 83 | 
             
            extra_rdoc_files: []
         | 
| 67 84 |  | 
| 68 85 | 
             
            files: 
         | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 94 | 
            -
             | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 97 | 
            -
             | 
| 98 | 
            -
             | 
| 99 | 
            -
             | 
| 100 | 
            -
             | 
| 101 | 
            -
             | 
| 102 | 
            -
             | 
| 103 | 
            -
             | 
| 104 | 
            -
             | 
| 105 | 
            -
             | 
| 106 | 
            -
             | 
| 107 | 
            -
             | 
| 108 | 
            -
             | 
| 109 | 
            -
             | 
| 110 | 
            -
             | 
| 111 | 
            -
             | 
| 112 | 
            -
             | 
| 113 | 
            -
             | 
| 114 | 
            -
             | 
| 115 | 
            -
             | 
| 116 | 
            -
             | 
| 117 | 
            -
             | 
| 118 | 
            -
             | 
| 119 | 
            -
             | 
| 120 | 
            -
             | 
| 121 | 
            -
             | 
| 122 | 
            -
             | 
| 123 | 
            -
             | 
| 124 | 
            -
             | 
| 125 | 
            -
             | 
| 126 | 
            -
             | 
| 127 | 
            -
             | 
| 128 | 
            -
             | 
| 129 | 
            -
             | 
| 130 | 
            -
             | 
| 131 | 
            -
             | 
| 132 | 
            -
             | 
| 133 | 
            -
             | 
| 134 | 
            -
             | 
| 135 | 
            -
             | 
| 136 | 
            -
             | 
| 137 | 
            -
             | 
| 138 | 
            -
             | 
| 139 | 
            -
             | 
| 140 | 
            -
             | 
| 141 | 
            -
             | 
| 142 | 
            -
             | 
| 143 | 
            -
             | 
| 144 | 
            -
             | 
| 145 | 
            -
             | 
| 146 | 
            -
             | 
| 147 | 
            -
             | 
| 148 | 
            -
             | 
| 149 | 
            -
             | 
| 150 | 
            -
             | 
| 151 | 
            -
             | 
| 152 | 
            -
             | 
| 153 | 
            -
             | 
| 154 | 
            -
             | 
| 155 | 
            -
             | 
| 156 | 
            -
             | 
| 157 | 
            -
             | 
| 158 | 
            -
             | 
| 159 | 
            -
             | 
| 160 | 
            -
             | 
| 161 | 
            -
             | 
| 162 | 
            -
             | 
| 163 | 
            -
             | 
| 164 | 
            -
             | 
| 165 | 
            -
             | 
| 166 | 
            -
             | 
| 167 | 
            -
             | 
| 168 | 
            -
             | 
| 169 | 
            -
             | 
| 170 | 
            -
             | 
| 171 | 
            -
             | 
| 172 | 
            -
             | 
| 173 | 
            -
             | 
| 174 | 
            -
             | 
| 175 | 
            -
             | 
| 176 | 
            -
             | 
| 177 | 
            -
             | 
| 178 | 
            -
             | 
| 179 | 
            -
             | 
| 180 | 
            -
             | 
| 181 | 
            -
             | 
| 86 | 
            +
            - lib/caruby/active_support/core_ext/string/inflections.rb
         | 
| 87 | 
            +
            - lib/caruby/active_support/core_ext/string.rb
         | 
| 88 | 
            +
            - lib/caruby/active_support/inflections.rb
         | 
| 89 | 
            +
            - lib/caruby/active_support/inflector.rb
         | 
| 90 | 
            +
            - lib/caruby/active_support/README.txt
         | 
| 91 | 
            +
            - lib/caruby/cli/application.rb
         | 
| 92 | 
            +
            - lib/caruby/cli/command.rb
         | 
| 93 | 
            +
            - lib/caruby/csv/csv_mapper.rb
         | 
| 94 | 
            +
            - lib/caruby/csv/csvio.rb
         | 
| 95 | 
            +
            - lib/caruby/database/fetched_matcher.rb
         | 
| 96 | 
            +
            - lib/caruby/database/lazy_loader.rb
         | 
| 97 | 
            +
            - lib/caruby/database/persistable.rb
         | 
| 98 | 
            +
            - lib/caruby/database/persistence_service.rb
         | 
| 99 | 
            +
            - lib/caruby/database/persistifier.rb
         | 
| 100 | 
            +
            - lib/caruby/database/reader.rb
         | 
| 101 | 
            +
            - lib/caruby/database/saved_matcher.rb
         | 
| 102 | 
            +
            - lib/caruby/database/search_template_builder.rb
         | 
| 103 | 
            +
            - lib/caruby/database/sql_executor.rb
         | 
| 104 | 
            +
            - lib/caruby/database/store_template_builder.rb
         | 
| 105 | 
            +
            - lib/caruby/database/writer.rb
         | 
| 106 | 
            +
            - lib/caruby/database.rb
         | 
| 107 | 
            +
            - lib/caruby/domain/attribute_metadata.rb
         | 
| 108 | 
            +
            - lib/caruby/domain/id_alias.rb
         | 
| 109 | 
            +
            - lib/caruby/domain/inversible.rb
         | 
| 110 | 
            +
            - lib/caruby/domain/java_attribute_metadata.rb
         | 
| 111 | 
            +
            - lib/caruby/domain/merge.rb
         | 
| 112 | 
            +
            - lib/caruby/domain/properties.rb
         | 
| 113 | 
            +
            - lib/caruby/domain/reference_visitor.rb
         | 
| 114 | 
            +
            - lib/caruby/domain/resource_attributes.rb
         | 
| 115 | 
            +
            - lib/caruby/domain/resource_dependency.rb
         | 
| 116 | 
            +
            - lib/caruby/domain/resource_introspection.rb
         | 
| 117 | 
            +
            - lib/caruby/domain/resource_inverse.rb
         | 
| 118 | 
            +
            - lib/caruby/domain/resource_metadata.rb
         | 
| 119 | 
            +
            - lib/caruby/domain/resource_module.rb
         | 
| 120 | 
            +
            - lib/caruby/domain/uniquify.rb
         | 
| 121 | 
            +
            - lib/caruby/import/java.rb
         | 
| 122 | 
            +
            - lib/caruby/migration/migratable.rb
         | 
| 123 | 
            +
            - lib/caruby/migration/migrator.rb
         | 
| 124 | 
            +
            - lib/caruby/migration/resource_module.rb
         | 
| 125 | 
            +
            - lib/caruby/migration/uniquify.rb
         | 
| 126 | 
            +
            - lib/caruby/resource.rb
         | 
| 127 | 
            +
            - lib/caruby/util/attribute_path.rb
         | 
| 128 | 
            +
            - lib/caruby/util/cache.rb
         | 
| 129 | 
            +
            - lib/caruby/util/class.rb
         | 
| 130 | 
            +
            - lib/caruby/util/collection.rb
         | 
| 131 | 
            +
            - lib/caruby/util/controlled_value.rb
         | 
| 132 | 
            +
            - lib/caruby/util/coordinate.rb
         | 
| 133 | 
            +
            - lib/caruby/util/domain_extent.rb
         | 
| 134 | 
            +
            - lib/caruby/util/file_separator.rb
         | 
| 135 | 
            +
            - lib/caruby/util/inflector.rb
         | 
| 136 | 
            +
            - lib/caruby/util/log.rb
         | 
| 137 | 
            +
            - lib/caruby/util/math.rb
         | 
| 138 | 
            +
            - lib/caruby/util/merge.rb
         | 
| 139 | 
            +
            - lib/caruby/util/module.rb
         | 
| 140 | 
            +
            - lib/caruby/util/options.rb
         | 
| 141 | 
            +
            - lib/caruby/util/partial_order.rb
         | 
| 142 | 
            +
            - lib/caruby/util/person.rb
         | 
| 143 | 
            +
            - lib/caruby/util/pretty_print.rb
         | 
| 144 | 
            +
            - lib/caruby/util/properties.rb
         | 
| 145 | 
            +
            - lib/caruby/util/roman.rb
         | 
| 146 | 
            +
            - lib/caruby/util/stopwatch.rb
         | 
| 147 | 
            +
            - lib/caruby/util/topological_sync_enumerator.rb
         | 
| 148 | 
            +
            - lib/caruby/util/transitive_closure.rb
         | 
| 149 | 
            +
            - lib/caruby/util/tree.rb
         | 
| 150 | 
            +
            - lib/caruby/util/trie.rb
         | 
| 151 | 
            +
            - lib/caruby/util/uniquifier.rb
         | 
| 152 | 
            +
            - lib/caruby/util/validation.rb
         | 
| 153 | 
            +
            - lib/caruby/util/version.rb
         | 
| 154 | 
            +
            - lib/caruby/util/visitor.rb
         | 
| 155 | 
            +
            - lib/caruby/util/weak_hash.rb
         | 
| 156 | 
            +
            - lib/caruby/version.rb
         | 
| 157 | 
            +
            - lib/caruby/yard/resource_metadata_handler.rb
         | 
| 158 | 
            +
            - lib/caruby.rb
         | 
| 159 | 
            +
            - test/lib/caruby/csv/csv_mapper_test.rb
         | 
| 160 | 
            +
            - test/lib/caruby/csv/csvio_test.rb
         | 
| 161 | 
            +
            - test/lib/caruby/database/persistable_test.rb
         | 
| 162 | 
            +
            - test/lib/caruby/domain/domain_test.rb
         | 
| 163 | 
            +
            - test/lib/caruby/domain/inversible_test.rb
         | 
| 164 | 
            +
            - test/lib/caruby/domain/reference_visitor_test.rb
         | 
| 165 | 
            +
            - test/lib/caruby/import/java_test.rb
         | 
| 166 | 
            +
            - test/lib/caruby/migration/test_case.rb
         | 
| 167 | 
            +
            - test/lib/caruby/test_case.rb
         | 
| 168 | 
            +
            - test/lib/caruby/util/cache_test.rb
         | 
| 169 | 
            +
            - test/lib/caruby/util/class_test.rb
         | 
| 170 | 
            +
            - test/lib/caruby/util/collection_test.rb
         | 
| 171 | 
            +
            - test/lib/caruby/util/command_test.rb
         | 
| 172 | 
            +
            - test/lib/caruby/util/controlled_value_test.rb
         | 
| 173 | 
            +
            - test/lib/caruby/util/domain_extent_test.rb
         | 
| 174 | 
            +
            - test/lib/caruby/util/file_separator_test.rb
         | 
| 175 | 
            +
            - test/lib/caruby/util/inflector_test.rb
         | 
| 176 | 
            +
            - test/lib/caruby/util/lazy_hash_test.rb
         | 
| 177 | 
            +
            - test/lib/caruby/util/merge_test.rb
         | 
| 178 | 
            +
            - test/lib/caruby/util/module_test.rb
         | 
| 179 | 
            +
            - test/lib/caruby/util/options_test.rb
         | 
| 180 | 
            +
            - test/lib/caruby/util/partial_order_test.rb
         | 
| 181 | 
            +
            - test/lib/caruby/util/person_test.rb
         | 
| 182 | 
            +
            - test/lib/caruby/util/pretty_print_test.rb
         | 
| 183 | 
            +
            - test/lib/caruby/util/properties_test.rb
         | 
| 184 | 
            +
            - test/lib/caruby/util/roman_test.rb
         | 
| 185 | 
            +
            - test/lib/caruby/util/stopwatch_test.rb
         | 
| 186 | 
            +
            - test/lib/caruby/util/topological_sync_enumerator_test.rb
         | 
| 187 | 
            +
            - test/lib/caruby/util/transitive_closure_test.rb
         | 
| 188 | 
            +
            - test/lib/caruby/util/tree_test.rb
         | 
| 189 | 
            +
            - test/lib/caruby/util/trie_test.rb
         | 
| 190 | 
            +
            - test/lib/caruby/util/version_test.rb
         | 
| 191 | 
            +
            - test/lib/caruby/util/visitor_test.rb
         | 
| 192 | 
            +
            - test/lib/caruby/util/weak_hash_test.rb
         | 
| 193 | 
            +
            - test/lib/examples/galena/clinical_trials/migration/participant_test.rb
         | 
| 194 | 
            +
            - test/lib/examples/galena/clinical_trials/migration/test_case.rb
         | 
| 195 | 
            +
            - History.txt
         | 
| 196 | 
            +
            - LEGAL
         | 
| 197 | 
            +
            - LICENSE
         | 
| 198 | 
            +
            - README.md
         | 
| 199 | 
            +
            has_rdoc: yard
         | 
| 200 | 
            +
            homepage: http://caruby.rubyforge.org
         | 
| 182 201 | 
             
            licenses: 
         | 
| 183 | 
            -
             | 
| 202 | 
            +
            - MIT
         | 
| 184 203 | 
             
            post_install_message: 
         | 
| 185 204 | 
             
            rdoc_options: []
         | 
| 186 205 |  | 
| 187 206 | 
             
            require_paths: 
         | 
| 188 | 
            -
             | 
| 207 | 
            +
            - lib
         | 
| 189 208 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 190 209 | 
             
              none: false
         | 
| 191 210 | 
             
              requirements: 
         | 
| 192 | 
            -
             | 
| 193 | 
            -
             | 
| 194 | 
            -
             | 
| 211 | 
            +
              - - ">="
         | 
| 212 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 213 | 
            +
                  hash: 3
         | 
| 214 | 
            +
                  segments: 
         | 
| 215 | 
            +
                  - 0
         | 
| 216 | 
            +
                  version: "0"
         | 
| 195 217 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 196 218 | 
             
              none: false
         | 
| 197 219 | 
             
              requirements: 
         | 
| 198 | 
            -
             | 
| 199 | 
            -
             | 
| 200 | 
            -
             | 
| 220 | 
            +
              - - ">="
         | 
| 221 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 222 | 
            +
                  hash: 3
         | 
| 223 | 
            +
                  segments: 
         | 
| 224 | 
            +
                  - 0
         | 
| 225 | 
            +
                  version: "0"
         | 
| 201 226 | 
             
            requirements: []
         | 
| 202 227 |  | 
| 203 228 | 
             
            rubyforge_project: caruby
         | 
| 204 | 
            -
            rubygems_version: 1. | 
| 229 | 
            +
            rubygems_version: 1.3.7
         | 
| 205 230 | 
             
            signing_key: 
         | 
| 206 231 | 
             
            specification_version: 3
         | 
| 207 232 | 
             
            summary: Ruby facade for caBIG applications.
         |