simmer 1.0.0.pre.alpha.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +8 -0
  3. data/.gitignore +7 -0
  4. data/.rubocop.yml +25 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +25 -0
  7. data/CHANGELOG.md +1 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/Gemfile +5 -0
  10. data/Guardfile +16 -0
  11. data/LICENSE +7 -0
  12. data/README.md +5 -0
  13. data/Rakefile +17 -0
  14. data/bin/console +18 -0
  15. data/bin/simmer +11 -0
  16. data/lib/simmer.rb +50 -0
  17. data/lib/simmer/configuration.rb +90 -0
  18. data/lib/simmer/core_ext/hash.rb +21 -0
  19. data/lib/simmer/externals.rb +12 -0
  20. data/lib/simmer/externals/aws_file_system.rb +81 -0
  21. data/lib/simmer/externals/mysql_database.rb +114 -0
  22. data/lib/simmer/externals/mysql_database/sql_fixture.rb +43 -0
  23. data/lib/simmer/externals/spoon_client.rb +77 -0
  24. data/lib/simmer/externals/spoon_client/mock.rb +39 -0
  25. data/lib/simmer/externals/spoon_client/result.rb +48 -0
  26. data/lib/simmer/judge.rb +38 -0
  27. data/lib/simmer/judge/result.rb +34 -0
  28. data/lib/simmer/runner.rb +125 -0
  29. data/lib/simmer/runner/result.rb +52 -0
  30. data/lib/simmer/session.rb +79 -0
  31. data/lib/simmer/session/reporter.rb +100 -0
  32. data/lib/simmer/session/result.rb +45 -0
  33. data/lib/simmer/specification.rb +34 -0
  34. data/lib/simmer/specification/act.rb +48 -0
  35. data/lib/simmer/specification/act/params.rb +55 -0
  36. data/lib/simmer/specification/assert.rb +27 -0
  37. data/lib/simmer/specification/assert/assertions.rb +27 -0
  38. data/lib/simmer/specification/assert/assertions/bad_output_assertion.rb +34 -0
  39. data/lib/simmer/specification/assert/assertions/bad_table_assertion.rb +38 -0
  40. data/lib/simmer/specification/assert/assertions/output.rb +37 -0
  41. data/lib/simmer/specification/assert/assertions/table.rb +47 -0
  42. data/lib/simmer/specification/stage.rb +28 -0
  43. data/lib/simmer/specification/stage/input_file.rb +33 -0
  44. data/lib/simmer/suite.rb +73 -0
  45. data/lib/simmer/util.rb +13 -0
  46. data/lib/simmer/util/evaluator.rb +32 -0
  47. data/lib/simmer/util/fixture.rb +32 -0
  48. data/lib/simmer/util/fixture_set.rb +41 -0
  49. data/lib/simmer/util/record.rb +54 -0
  50. data/lib/simmer/util/record_set.rb +51 -0
  51. data/lib/simmer/util/resolver.rb +28 -0
  52. data/lib/simmer/util/yaml_reader.rb +61 -0
  53. data/lib/simmer/version.rb +12 -0
  54. data/simmer.gemspec +38 -0
  55. data/spec/simmer/core_ext/hash_spec.rb +16 -0
  56. data/spec/spec_helper.rb +22 -0
  57. metadata +284 -0
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright (c) 2020-present, Blue Marble Payroll, LLC
5
+ #
6
+ # This source code is licensed under the MIT license found in the
7
+ # LICENSE file in the root directory of this source tree.
8
+ #
9
+
10
+ module Simmer
11
+ module Util
12
+ # A less strict comparable hash data structure. It does not depend on key type, value type,
13
+ # and key ordering.
14
+ class Record
15
+ extend Forwardable
16
+
17
+ attr_reader :data
18
+
19
+ def_delegators :data, :to_h
20
+
21
+ def initialize(data = {})
22
+ @data = sorted_string_hash(data)
23
+ end
24
+
25
+ def <=>(other)
26
+ data <=> other.data
27
+ end
28
+
29
+ def ==(other)
30
+ other.instance_of?(self.class) && data == other.data
31
+ end
32
+ alias eql? ==
33
+
34
+ def keys
35
+ data.map(&:first)
36
+ end
37
+
38
+ private
39
+
40
+ def sorted_string_hash(hash)
41
+ (hash || {}).map do |k, v|
42
+ key = k.to_s
43
+ value = convert(v)
44
+
45
+ [key, value]
46
+ end.sort
47
+ end
48
+
49
+ def convert(value)
50
+ value.is_a?(BigDecimal) ? value.to_s('F') : value.to_s
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright (c) 2020-present, Blue Marble Payroll, LLC
5
+ #
6
+ # This source code is licensed under the MIT license found in the
7
+ # LICENSE file in the root directory of this source tree.
8
+ #
9
+
10
+ require_relative 'record'
11
+
12
+ module Simmer
13
+ module Util
14
+ # A less-strict comparable collection of Record instances.
15
+ # It does not depend on Record ordering.
16
+ class RecordSet
17
+ attr_reader :records
18
+
19
+ def initialize(records = [])
20
+ @records = array(records).map { |record| Record.new(record) }.sort
21
+
22
+ freeze
23
+ end
24
+
25
+ def ==(other)
26
+ other.instance_of?(self.class) && records == other.records
27
+ end
28
+ alias eql? ==
29
+
30
+ def to_h
31
+ {
32
+ 'records' => records.map(&:to_h)
33
+ }
34
+ end
35
+
36
+ def keys
37
+ records.first&.keys || []
38
+ end
39
+
40
+ private
41
+
42
+ def array(val)
43
+ if val.is_a?(Hash)
44
+ [val]
45
+ else
46
+ Array(val)
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright (c) 2020-present, Blue Marble Payroll, LLC
5
+ #
6
+ # This source code is licensed under the MIT license found in the
7
+ # LICENSE file in the root directory of this source tree.
8
+ #
9
+
10
+ module Simmer
11
+ module Util
12
+ # Wraps up Objectable so it can be plugged into Stringento so we can use Objectable
13
+ # as an object resolver.
14
+ class Resolver
15
+ attr_reader :objectable_resolver
16
+
17
+ def initialize
18
+ @objectable_resolver = Objectable.resolver
19
+
20
+ freeze
21
+ end
22
+
23
+ def resolve(value, input)
24
+ objectable_resolver.get(input, value)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright (c) 2020-present, Blue Marble Payroll, LLC
5
+ #
6
+ # This source code is licensed under the MIT license found in the
7
+ # LICENSE file in the root directory of this source tree.
8
+ #
9
+
10
+ module Simmer
11
+ module Util
12
+ # Understands how to read YAML. You can utilize this tool to recursively read an entire
13
+ # directory of YAML files and combine them into one YAML file, or simply read one YAML file.
14
+ class YamlReader
15
+ EXTENSIONS = %w[yml yaml].freeze
16
+
17
+ private_constant :EXTENSIONS
18
+
19
+ def smash(path)
20
+ files = all(path).values
21
+
22
+ files.each_with_object({}) do |config, memo|
23
+ memo.merge!(config)
24
+ end
25
+ end
26
+
27
+ def all(path)
28
+ expand(path).map { |file| [file, read(file)] }.to_h
29
+ end
30
+
31
+ def read(path)
32
+ path = File.expand_path(path)
33
+ contents = File.read(path)
34
+
35
+ YAML.safe_load(contents) || {}
36
+ end
37
+
38
+ private
39
+
40
+ def wildcard_name
41
+ "*.{#{EXTENSIONS.join(',')}}"
42
+ end
43
+
44
+ def full_path(path)
45
+ File.join(path, '**', wildcard_name)
46
+ end
47
+
48
+ def expand(path)
49
+ path = File.expand_path(path.to_s)
50
+
51
+ if File.directory?(path)
52
+ glob = full_path(path)
53
+
54
+ Dir[glob].to_a
55
+ else
56
+ Array(path)
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright (c) 2020-present, Blue Marble Payroll, LLC
5
+ #
6
+ # This source code is licensed under the MIT license found in the
7
+ # LICENSE file in the root directory of this source tree.
8
+ #
9
+
10
+ module Simmer
11
+ VERSION = '1.0.0-alpha.2'
12
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require './lib/simmer/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'simmer'
7
+ s.version = Simmer::VERSION
8
+ s.summary = 'Pentaho Data Integration Automated Test Suite'
9
+
10
+ s.description = <<-DESCRIPTION
11
+ Provides a harness for testing Pentaho Data Integration jobs and transformations.
12
+ DESCRIPTION
13
+
14
+ s.authors = ['Matthew Ruggio']
15
+ s.email = ['mruggio@bluemarblepayroll.com']
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = %w[simmer]
19
+ s.homepage = 'https://github.com/bluemarblepayroll/simmer'
20
+ s.license = 'MIT'
21
+
22
+ s.required_ruby_version = '>= 2.4.6'
23
+
24
+ s.add_dependency('acts_as_hashable', '~>1')
25
+ s.add_dependency('aws-sdk-s3', '~>1.6')
26
+ s.add_dependency('mysql2', '~>0.5')
27
+ s.add_dependency('objectable', '~>1')
28
+ s.add_dependency('pdi', '~>1')
29
+ s.add_dependency('stringento', '~>2')
30
+
31
+ s.add_development_dependency('guard-rspec', '~>4.7')
32
+ s.add_development_dependency('pry', '~>0')
33
+ s.add_development_dependency('rake', '~> 13')
34
+ s.add_development_dependency('rspec')
35
+ s.add_development_dependency('rubocop', '~>0.79.0')
36
+ s.add_development_dependency('simplecov', '~>0.17.0')
37
+ s.add_development_dependency('simplecov-console', '~>0.6.0')
38
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright (c) 2020-present, Blue Marble Payroll, LLC
5
+ #
6
+ # This source code is licensed under the MIT license found in the
7
+ # LICENSE file in the root directory of this source tree.
8
+ #
9
+
10
+ require 'spec_helper'
11
+
12
+ describe Simmer::CoreExt::Hash do
13
+ specify 'Hash#symbolize_keys is implemented' do
14
+ expect({ 'a' => 'b' }.symbolize_keys).to eq(a: 'b')
15
+ end
16
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright (c) 2020-present, Blue Marble Payroll, LLC
5
+ #
6
+ # This source code is licensed under the MIT license found in the
7
+ # LICENSE file in the root directory of this source tree.
8
+ #
9
+
10
+ require 'pry'
11
+
12
+ unless ENV['DISABLE_SIMPLECOV'] == 'true'
13
+ require 'simplecov'
14
+ require 'simplecov-console'
15
+
16
+ SimpleCov.formatter = SimpleCov::Formatter::Console
17
+ SimpleCov.start do
18
+ add_filter %r{\A/spec/}
19
+ end
20
+ end
21
+
22
+ require './lib/simmer'
metadata ADDED
@@ -0,0 +1,284 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simmer
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.pre.alpha.2
5
+ platform: ruby
6
+ authors:
7
+ - Matthew Ruggio
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-02-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: acts_as_hashable
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: aws-sdk-s3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: mysql2
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.5'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: objectable
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pdi
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: stringento
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard-rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '4.7'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '4.7'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rake
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '13'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '13'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 0.79.0
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 0.79.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: simplecov
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 0.17.0
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 0.17.0
181
+ - !ruby/object:Gem::Dependency
182
+ name: simplecov-console
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 0.6.0
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: 0.6.0
195
+ description: " Provides a harness for testing Pentaho Data Integration jobs and
196
+ transformations.\n"
197
+ email:
198
+ - mruggio@bluemarblepayroll.com
199
+ executables:
200
+ - simmer
201
+ extensions: []
202
+ extra_rdoc_files: []
203
+ files:
204
+ - ".editorconfig"
205
+ - ".gitignore"
206
+ - ".rubocop.yml"
207
+ - ".ruby-version"
208
+ - ".travis.yml"
209
+ - CHANGELOG.md
210
+ - CODE_OF_CONDUCT.md
211
+ - Gemfile
212
+ - Guardfile
213
+ - LICENSE
214
+ - README.md
215
+ - Rakefile
216
+ - bin/console
217
+ - bin/simmer
218
+ - lib/simmer.rb
219
+ - lib/simmer/configuration.rb
220
+ - lib/simmer/core_ext/hash.rb
221
+ - lib/simmer/externals.rb
222
+ - lib/simmer/externals/aws_file_system.rb
223
+ - lib/simmer/externals/mysql_database.rb
224
+ - lib/simmer/externals/mysql_database/sql_fixture.rb
225
+ - lib/simmer/externals/spoon_client.rb
226
+ - lib/simmer/externals/spoon_client/mock.rb
227
+ - lib/simmer/externals/spoon_client/result.rb
228
+ - lib/simmer/judge.rb
229
+ - lib/simmer/judge/result.rb
230
+ - lib/simmer/runner.rb
231
+ - lib/simmer/runner/result.rb
232
+ - lib/simmer/session.rb
233
+ - lib/simmer/session/reporter.rb
234
+ - lib/simmer/session/result.rb
235
+ - lib/simmer/specification.rb
236
+ - lib/simmer/specification/act.rb
237
+ - lib/simmer/specification/act/params.rb
238
+ - lib/simmer/specification/assert.rb
239
+ - lib/simmer/specification/assert/assertions.rb
240
+ - lib/simmer/specification/assert/assertions/bad_output_assertion.rb
241
+ - lib/simmer/specification/assert/assertions/bad_table_assertion.rb
242
+ - lib/simmer/specification/assert/assertions/output.rb
243
+ - lib/simmer/specification/assert/assertions/table.rb
244
+ - lib/simmer/specification/stage.rb
245
+ - lib/simmer/specification/stage/input_file.rb
246
+ - lib/simmer/suite.rb
247
+ - lib/simmer/util.rb
248
+ - lib/simmer/util/evaluator.rb
249
+ - lib/simmer/util/fixture.rb
250
+ - lib/simmer/util/fixture_set.rb
251
+ - lib/simmer/util/record.rb
252
+ - lib/simmer/util/record_set.rb
253
+ - lib/simmer/util/resolver.rb
254
+ - lib/simmer/util/yaml_reader.rb
255
+ - lib/simmer/version.rb
256
+ - simmer.gemspec
257
+ - spec/simmer/core_ext/hash_spec.rb
258
+ - spec/spec_helper.rb
259
+ homepage: https://github.com/bluemarblepayroll/simmer
260
+ licenses:
261
+ - MIT
262
+ metadata: {}
263
+ post_install_message:
264
+ rdoc_options: []
265
+ require_paths:
266
+ - lib
267
+ required_ruby_version: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - ">="
270
+ - !ruby/object:Gem::Version
271
+ version: 2.4.6
272
+ required_rubygems_version: !ruby/object:Gem::Requirement
273
+ requirements:
274
+ - - ">"
275
+ - !ruby/object:Gem::Version
276
+ version: 1.3.1
277
+ requirements: []
278
+ rubygems_version: 3.0.3
279
+ signing_key:
280
+ specification_version: 4
281
+ summary: Pentaho Data Integration Automated Test Suite
282
+ test_files:
283
+ - spec/simmer/core_ext/hash_spec.rb
284
+ - spec/spec_helper.rb