dor-workflow-client 5.1.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -1
- data/.rubocop.yml +141 -4
- data/.rubocop_todo.yml +24 -42
- data/Gemfile.lock +55 -50
- data/dor-workflow-client.gemspec +1 -1
- data/lib/dor/workflow/client/status.rb +41 -41
- data/lib/dor/workflow/client/version.rb +1 -1
- data/spec/{workflow → dor/workflow}/client/connection_factory_spec.rb +7 -5
- data/spec/{workflow → dor/workflow}/client/status_spec.rb +13 -11
- data/spec/{workflow → dor/workflow}/client/workflow_routes_spec.rb +6 -13
- data/spec/{workflow → dor/workflow}/client/workflow_template_spec.rb +2 -0
- data/spec/{workflow → dor/workflow}/client_spec.rb +42 -33
- data/spec/{models → dor/workflow}/response/process_spec.rb +6 -1
- data/spec/{models → dor/workflow}/response/workflow_spec.rb +7 -0
- data/spec/{models → dor/workflow}/response/workflows_spec.rb +4 -3
- metadata +18 -18
- data/spec/{workflow → dor/workflow}/client/lifecycle_routes_spec.rb +2 -2
- /data/spec/{workflow → dor/workflow}/client/requestor_spec.rb +0 -0
- /data/spec/{workflow → dor/workflow}/client/version_routes_spec.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b02179966ff3ccea0895b6f24e697893d1f6f86ca19f11e4f7e1bf1cd431d2d2
|
4
|
+
data.tar.gz: 34e3c8191e88642e1850fa346552a2f986a809289334193f6bee25273b20f81f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 100a4642fffa4640ad6f35cff6ec1e8e224919985c6f2852bbf840790350bdc9bd4fca81a9a343eb86eced7e69a489d0ed25fc32d0036c511fc581267efc5ce8
|
7
|
+
data.tar.gz: c3d5755642cff98de6adba80ea2e67dbe61195e38885dd7c4163409d3d978e49420a9ef1f55488133d49724affc985f0ad8463560fe58c5eae0c3ecabc616ec9
|
data/.circleci/config.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,17 +1,37 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
2
|
|
3
|
+
require:
|
4
|
+
- rubocop-rake
|
5
|
+
- rubocop-rspec
|
6
|
+
|
3
7
|
AllCops:
|
4
8
|
TargetRubyVersion: 3.0
|
5
|
-
# Configuration parameters: AllowURI, URISchemes.
|
9
|
+
# Configuration parameters: AllowURI, URISchemes.
|
10
|
+
Exclude:
|
11
|
+
- 'vendor/**/*'
|
12
|
+
|
13
|
+
|
6
14
|
Layout/LineLength:
|
7
15
|
Max: 300
|
8
16
|
|
17
|
+
Lint/UnusedBlockArgument:
|
18
|
+
AllowUnusedKeywordArguments: true
|
19
|
+
|
9
20
|
Metrics/BlockLength:
|
10
21
|
Exclude:
|
11
22
|
- spec/**/*_spec.rb
|
12
23
|
|
13
|
-
|
14
|
-
|
24
|
+
RSpec/ExampleLength:
|
25
|
+
Max: 10
|
26
|
+
|
27
|
+
RSpec/MultipleMemoizedHelpers:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
RSpec/MultipleExpectations:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
RSpec/NestedGroups:
|
34
|
+
Max: 4
|
15
35
|
|
16
36
|
Gemspec/DeprecatedAttributeAssignment: # new in 1.10
|
17
37
|
Enabled: true
|
@@ -143,4 +163,121 @@ Style/NestedFileDirname: # new in 1.26
|
|
143
163
|
Style/ObjectThen: # new in 1.28
|
144
164
|
Enabled: true
|
145
165
|
Style/RedundantInitialize: # new in 1.27
|
146
|
-
Enabled: true
|
166
|
+
Enabled: true
|
167
|
+
|
168
|
+
Lint/DuplicateMagicComment: # new in 1.37
|
169
|
+
Enabled: true
|
170
|
+
Lint/DuplicateMatchPattern: # new in 1.50
|
171
|
+
Enabled: true
|
172
|
+
Lint/UselessRescue: # new in 1.43
|
173
|
+
Enabled: true
|
174
|
+
Metrics/CollectionLiteralLength: # new in 1.47
|
175
|
+
Enabled: true
|
176
|
+
Style/ArrayIntersect: # new in 1.40
|
177
|
+
Enabled: true
|
178
|
+
Style/ComparableClamp: # new in 1.44
|
179
|
+
Enabled: true
|
180
|
+
Style/ConcatArrayLiterals: # new in 1.41
|
181
|
+
Enabled: true
|
182
|
+
Style/DataInheritance: # new in 1.49
|
183
|
+
Enabled: true
|
184
|
+
Style/DirEmpty: # new in 1.48
|
185
|
+
Enabled: true
|
186
|
+
Style/ExactRegexpMatch: # new in 1.51
|
187
|
+
Enabled: true
|
188
|
+
Style/FileEmpty: # new in 1.48
|
189
|
+
Enabled: true
|
190
|
+
Style/MagicCommentFormat: # new in 1.35
|
191
|
+
Enabled: true
|
192
|
+
Style/MapToSet: # new in 1.42
|
193
|
+
Enabled: true
|
194
|
+
Style/MinMaxComparison: # new in 1.42
|
195
|
+
Enabled: true
|
196
|
+
Style/OperatorMethodCall: # new in 1.37
|
197
|
+
Enabled: true
|
198
|
+
Style/RedundantArrayConstructor: # new in 1.52
|
199
|
+
Enabled: true
|
200
|
+
Style/RedundantConstantBase: # new in 1.40
|
201
|
+
Enabled: true
|
202
|
+
Style/RedundantDoubleSplatHashBraces: # new in 1.41
|
203
|
+
Enabled: true
|
204
|
+
Style/RedundantEach: # new in 1.38
|
205
|
+
Enabled: true
|
206
|
+
Style/RedundantFilterChain: # new in 1.52
|
207
|
+
Enabled: true
|
208
|
+
Style/RedundantHeredocDelimiterQuotes: # new in 1.45
|
209
|
+
Enabled: true
|
210
|
+
Style/RedundantLineContinuation: # new in 1.49
|
211
|
+
Enabled: true
|
212
|
+
Style/RedundantRegexpConstructor: # new in 1.52
|
213
|
+
Enabled: true
|
214
|
+
Style/RedundantStringEscape: # new in 1.37
|
215
|
+
Enabled: true
|
216
|
+
|
217
|
+
Capybara/MatchStyle: # new in 2.17
|
218
|
+
Enabled: true
|
219
|
+
Capybara/NegationMatcher: # new in 2.14
|
220
|
+
Enabled: true
|
221
|
+
Capybara/SpecificActions: # new in 2.14
|
222
|
+
Enabled: true
|
223
|
+
Capybara/SpecificFinders: # new in 2.13
|
224
|
+
Enabled: true
|
225
|
+
Capybara/SpecificMatcher: # new in 2.12
|
226
|
+
Enabled: true
|
227
|
+
FactoryBot/AssociationStyle: # new in 2.23
|
228
|
+
Enabled: true
|
229
|
+
FactoryBot/ConsistentParenthesesStyle: # new in 2.14
|
230
|
+
Enabled: true
|
231
|
+
FactoryBot/FactoryAssociationWithStrategy: # new in 2.23
|
232
|
+
Enabled: true
|
233
|
+
FactoryBot/FactoryNameStyle: # new in 2.16
|
234
|
+
Enabled: true
|
235
|
+
FactoryBot/RedundantFactoryOption: # new in 2.23
|
236
|
+
Enabled: true
|
237
|
+
FactoryBot/SyntaxMethods: # new in 2.7
|
238
|
+
Enabled: true
|
239
|
+
RSpec/BeEmpty: # new in 2.20
|
240
|
+
Enabled: true
|
241
|
+
RSpec/BeEq: # new in 2.9.0
|
242
|
+
Enabled: true
|
243
|
+
RSpec/BeNil: # new in 2.9.0
|
244
|
+
Enabled: true
|
245
|
+
RSpec/ChangeByZero: # new in 2.11
|
246
|
+
Enabled: true
|
247
|
+
RSpec/ContainExactly: # new in 2.19
|
248
|
+
Enabled: true
|
249
|
+
RSpec/DuplicatedMetadata: # new in 2.16
|
250
|
+
Enabled: true
|
251
|
+
RSpec/ExcessiveDocstringSpacing: # new in 2.5
|
252
|
+
Enabled: true
|
253
|
+
RSpec/IdenticalEqualityAssertion: # new in 2.4
|
254
|
+
Enabled: true
|
255
|
+
RSpec/IndexedLet: # new in 2.20
|
256
|
+
Enabled: true
|
257
|
+
RSpec/MatchArray: # new in 2.19
|
258
|
+
Enabled: true
|
259
|
+
RSpec/NoExpectationExample: # new in 2.13
|
260
|
+
Enabled: true
|
261
|
+
RSpec/PendingWithoutReason: # new in 2.16
|
262
|
+
Enabled: true
|
263
|
+
RSpec/RedundantAround: # new in 2.19
|
264
|
+
Enabled: true
|
265
|
+
RSpec/SkipBlockInsideExample: # new in 2.19
|
266
|
+
Enabled: true
|
267
|
+
RSpec/SortMetadata: # new in 2.14
|
268
|
+
Enabled: true
|
269
|
+
RSpec/SubjectDeclaration: # new in 2.5
|
270
|
+
Enabled: true
|
271
|
+
RSpec/VerifiedDoubleReference: # new in 2.10.0
|
272
|
+
Enabled: true
|
273
|
+
RSpec/Rails/AvoidSetupHook: # new in 2.4
|
274
|
+
Enabled: true
|
275
|
+
RSpec/Rails/HaveHttpStatus: # new in 2.12
|
276
|
+
Enabled: true
|
277
|
+
RSpec/Rails/InferredSpecType: # new in 2.14
|
278
|
+
Enabled: true
|
279
|
+
RSpec/Rails/MinitestAssertions: # new in 2.17
|
280
|
+
Enabled: true
|
281
|
+
RSpec/Rails/TravelAround: # new in 2.19
|
282
|
+
Enabled: true
|
283
|
+
|
data/.rubocop_todo.yml
CHANGED
@@ -1,58 +1,40 @@
|
|
1
1
|
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
2
|
+
# `rubocop --auto-gen-config --auto-gen-only-exclude`
|
3
|
+
# on 2023-06-20 15:30:24 UTC using RuboCop version 1.52.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count: 1
|
10
|
-
# Configuration parameters: Include.
|
11
|
-
# Include: **/*.gemspec
|
12
|
-
Gemspec/RequiredRubyVersion:
|
13
|
-
Exclude:
|
14
|
-
- 'dor-workflow-client.gemspec'
|
15
|
-
|
16
|
-
# Offense count: 1
|
17
|
-
# Configuration parameters: AllowComments, AllowEmptyLambdas.
|
18
|
-
Lint/EmptyBlock:
|
19
|
-
Exclude:
|
20
|
-
- 'spec/workflow/client/workflow_routes_spec.rb'
|
21
|
-
|
22
|
-
# Offense count: 1
|
23
|
-
Lint/NoReturnInBeginEndBlocks:
|
24
|
-
Exclude:
|
25
|
-
- 'lib/dor/workflow/client/status.rb'
|
26
|
-
|
27
|
-
# Offense count: 5
|
28
|
-
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
29
|
-
Metrics/AbcSize:
|
30
|
-
Max: 23
|
31
|
-
|
32
9
|
# Offense count: 2
|
33
|
-
# Configuration parameters:
|
34
|
-
Metrics/
|
35
|
-
|
10
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
11
|
+
Metrics/AbcSize:
|
12
|
+
Exclude:
|
13
|
+
- 'lib/dor/workflow/client/connection_factory.rb'
|
14
|
+
- 'lib/dor/workflow/client/queues.rb'
|
36
15
|
|
37
16
|
# Offense count: 2
|
38
|
-
# Configuration parameters: CountComments, CountAsOne,
|
17
|
+
# Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns.
|
39
18
|
Metrics/MethodLength:
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
44
|
-
Metrics/ParameterLists:
|
45
|
-
Max: 8
|
19
|
+
Exclude:
|
20
|
+
- 'lib/dor/workflow/client/connection_factory.rb'
|
21
|
+
- 'lib/dor/workflow/client/queues.rb'
|
46
22
|
|
47
23
|
# Offense count: 1
|
48
|
-
#
|
49
|
-
|
24
|
+
# Configuration parameters: Max, CountKeywordArgs, MaxOptionalParameters.
|
25
|
+
Metrics/ParameterLists:
|
50
26
|
Exclude:
|
51
27
|
- 'lib/dor/workflow/client/workflow_routes.rb'
|
52
28
|
|
53
|
-
# Offense count:
|
54
|
-
#
|
55
|
-
|
56
|
-
|
29
|
+
# Offense count: 73
|
30
|
+
# Configuration parameters: AssignmentOnly.
|
31
|
+
RSpec/InstanceVariable:
|
32
|
+
Exclude:
|
33
|
+
- 'spec/dor/workflow/client_spec.rb'
|
34
|
+
|
35
|
+
# Offense count: 7
|
36
|
+
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
37
|
+
RSpec/VerifiedDoubles:
|
57
38
|
Exclude:
|
58
|
-
- '
|
39
|
+
- 'spec/dor/workflow/client/connection_factory_spec.rb'
|
40
|
+
- 'spec/dor/workflow/client_spec.rb'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dor-workflow-client (
|
4
|
+
dor-workflow-client (6.0.0)
|
5
5
|
activesupport (>= 3.2.1, < 8)
|
6
6
|
deprecation (>= 0.99.0)
|
7
7
|
faraday (~> 2.0)
|
@@ -12,96 +12,101 @@ PATH
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
-
activesupport (7.0.
|
15
|
+
activesupport (7.0.5)
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
17
|
i18n (>= 1.6, < 2)
|
18
18
|
minitest (>= 5.1)
|
19
19
|
tzinfo (~> 2.0)
|
20
|
-
addressable (2.8.
|
21
|
-
public_suffix (>= 2.0.2, <
|
20
|
+
addressable (2.8.4)
|
21
|
+
public_suffix (>= 2.0.2, < 6.0)
|
22
22
|
ast (2.4.2)
|
23
23
|
byebug (11.1.3)
|
24
|
-
concurrent-ruby (1.
|
24
|
+
concurrent-ruby (1.2.2)
|
25
25
|
crack (0.4.5)
|
26
26
|
rexml
|
27
27
|
deprecation (1.1.0)
|
28
28
|
activesupport
|
29
29
|
diff-lcs (1.5.0)
|
30
30
|
docile (1.4.0)
|
31
|
-
faraday (2.
|
32
|
-
faraday-net_http (
|
31
|
+
faraday (2.7.6)
|
32
|
+
faraday-net_http (>= 2.0, < 3.1)
|
33
33
|
ruby2_keywords (>= 0.0.4)
|
34
|
-
faraday-net_http (
|
35
|
-
faraday-retry (2.
|
34
|
+
faraday-net_http (3.0.2)
|
35
|
+
faraday-retry (2.2.0)
|
36
36
|
faraday (~> 2.0)
|
37
37
|
hashdiff (1.0.1)
|
38
|
-
i18n (1.
|
38
|
+
i18n (1.14.1)
|
39
39
|
concurrent-ruby (~> 1.0)
|
40
|
-
json (2.6.
|
41
|
-
mini_portile2 (2.8.
|
42
|
-
minitest (5.
|
43
|
-
nokogiri (1.
|
44
|
-
mini_portile2 (~> 2.8.
|
40
|
+
json (2.6.3)
|
41
|
+
mini_portile2 (2.8.2)
|
42
|
+
minitest (5.18.1)
|
43
|
+
nokogiri (1.15.2)
|
44
|
+
mini_portile2 (~> 2.8.2)
|
45
45
|
racc (~> 1.4)
|
46
|
-
parallel (1.
|
47
|
-
parser (3.
|
46
|
+
parallel (1.23.0)
|
47
|
+
parser (3.2.2.3)
|
48
48
|
ast (~> 2.4.1)
|
49
|
-
|
50
|
-
|
49
|
+
racc
|
50
|
+
public_suffix (5.0.1)
|
51
|
+
racc (1.7.1)
|
51
52
|
rainbow (3.1.1)
|
52
53
|
rake (13.0.6)
|
53
|
-
regexp_parser (2.
|
54
|
+
regexp_parser (2.8.1)
|
54
55
|
rexml (3.2.5)
|
55
|
-
rspec (3.
|
56
|
-
rspec-core (~> 3.
|
57
|
-
rspec-expectations (~> 3.
|
58
|
-
rspec-mocks (~> 3.
|
59
|
-
rspec-core (3.
|
60
|
-
rspec-support (~> 3.
|
61
|
-
rspec-expectations (3.
|
56
|
+
rspec (3.12.0)
|
57
|
+
rspec-core (~> 3.12.0)
|
58
|
+
rspec-expectations (~> 3.12.0)
|
59
|
+
rspec-mocks (~> 3.12.0)
|
60
|
+
rspec-core (3.12.2)
|
61
|
+
rspec-support (~> 3.12.0)
|
62
|
+
rspec-expectations (3.12.3)
|
62
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
63
|
-
rspec-support (~> 3.
|
64
|
-
rspec-mocks (3.
|
64
|
+
rspec-support (~> 3.12.0)
|
65
|
+
rspec-mocks (3.12.5)
|
65
66
|
diff-lcs (>= 1.2.0, < 2.0)
|
66
|
-
rspec-support (~> 3.
|
67
|
-
rspec-support (3.
|
68
|
-
rspec_junit_formatter (0.
|
67
|
+
rspec-support (~> 3.12.0)
|
68
|
+
rspec-support (3.12.0)
|
69
|
+
rspec_junit_formatter (0.6.0)
|
69
70
|
rspec-core (>= 2, < 4, != 2.12.0)
|
70
|
-
rubocop (1.
|
71
|
+
rubocop (1.52.1)
|
71
72
|
json (~> 2.3)
|
72
73
|
parallel (~> 1.10)
|
73
|
-
parser (>= 3.
|
74
|
+
parser (>= 3.2.2.3)
|
74
75
|
rainbow (>= 2.2.2, < 4.0)
|
75
76
|
regexp_parser (>= 1.8, < 3.0)
|
76
77
|
rexml (>= 3.2.5, < 4.0)
|
77
|
-
rubocop-ast (>= 1.
|
78
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
78
79
|
ruby-progressbar (~> 1.7)
|
79
|
-
unicode-display_width (>=
|
80
|
-
rubocop-ast (1.
|
81
|
-
parser (>= 3.
|
80
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
81
|
+
rubocop-ast (1.29.0)
|
82
|
+
parser (>= 3.2.1.0)
|
83
|
+
rubocop-capybara (2.18.0)
|
84
|
+
rubocop (~> 1.41)
|
85
|
+
rubocop-factory_bot (2.23.1)
|
86
|
+
rubocop (~> 1.33)
|
82
87
|
rubocop-rake (0.6.0)
|
83
88
|
rubocop (~> 1.0)
|
84
|
-
rubocop-rspec (2.
|
85
|
-
rubocop (~> 1.
|
86
|
-
|
89
|
+
rubocop-rspec (2.22.0)
|
90
|
+
rubocop (~> 1.33)
|
91
|
+
rubocop-capybara (~> 2.17)
|
92
|
+
rubocop-factory_bot (~> 2.22)
|
93
|
+
ruby-progressbar (1.13.0)
|
87
94
|
ruby2_keywords (0.0.5)
|
88
|
-
simplecov (0.
|
95
|
+
simplecov (0.22.0)
|
89
96
|
docile (~> 1.1)
|
90
97
|
simplecov-html (~> 0.11)
|
91
98
|
simplecov_json_formatter (~> 0.1)
|
92
99
|
simplecov-html (0.12.3)
|
93
100
|
simplecov_json_formatter (0.1.4)
|
94
|
-
tzinfo (2.0.
|
101
|
+
tzinfo (2.0.6)
|
95
102
|
concurrent-ruby (~> 1.0)
|
96
|
-
unicode-display_width (2.2
|
97
|
-
webmock (3.
|
103
|
+
unicode-display_width (2.4.2)
|
104
|
+
webmock (3.18.1)
|
98
105
|
addressable (>= 2.8.0)
|
99
106
|
crack (>= 0.3.2)
|
100
107
|
hashdiff (>= 0.4.0, < 2.0.0)
|
101
|
-
|
102
|
-
|
103
|
-
webrick (~> 1.7.0)
|
104
|
-
zeitwerk (2.6.0)
|
108
|
+
yard (0.9.34)
|
109
|
+
zeitwerk (2.6.8)
|
105
110
|
|
106
111
|
PLATFORMS
|
107
112
|
ruby
|
@@ -120,4 +125,4 @@ DEPENDENCIES
|
|
120
125
|
yard
|
121
126
|
|
122
127
|
BUNDLED WITH
|
123
|
-
2.
|
128
|
+
2.4.13
|
data/dor-workflow-client.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
|
16
16
|
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
17
|
gem.require_paths = ['lib']
|
18
|
-
gem.required_ruby_version = '>=
|
18
|
+
gem.required_ruby_version = '>= 3.0'
|
19
19
|
|
20
20
|
gem.add_dependency 'activesupport', '>= 3.2.1', '< 8'
|
21
21
|
gem.add_dependency 'deprecation', '>= 0.99.0'
|
@@ -32,6 +32,8 @@ module Dor
|
|
32
32
|
'opened' => 9
|
33
33
|
}.freeze
|
34
34
|
|
35
|
+
attr_reader :status_code
|
36
|
+
|
35
37
|
# @param [String] druid the object identifier
|
36
38
|
# @param [String|Integer] version the version identifier
|
37
39
|
# @param [LifecycleRoutes] lifecycle_routes the lifecycle client
|
@@ -39,40 +41,12 @@ module Dor
|
|
39
41
|
@druid = druid
|
40
42
|
@version = version.to_s
|
41
43
|
@lifecycle_routes = lifecycle_routes
|
42
|
-
|
43
|
-
|
44
|
-
# @return [Hash{Symbol => Object}] including :status_code and :status_time
|
45
|
-
def info
|
46
|
-
@info ||= begin
|
47
|
-
# if we have an accessioned milestone, this is the last possible step and should be the status regardless of time stamp
|
48
|
-
accessioned_milestones = current_milestones.select { |m| m[:milestone] == 'accessioned' }
|
49
|
-
return { status_code: STEPS['accessioned'], status_time: accessioned_milestones.last[:at].utc.xmlschema } unless accessioned_milestones.empty?
|
50
|
-
|
51
|
-
status_code = 0
|
52
|
-
status_time = nil
|
53
|
-
# for each milestone in the current version, see if it comes at the same time or after the current 'last' step, if so, make it the last and record the date/time
|
54
|
-
current_milestones.each do |m|
|
55
|
-
m_name = m[:milestone]
|
56
|
-
m_time = m[:at].utc.xmlschema
|
57
|
-
next unless STEPS.key?(m_name) && (!status_time || m_time >= status_time)
|
58
|
-
|
59
|
-
status_code = STEPS[m_name]
|
60
|
-
status_time = m_time
|
61
|
-
end
|
62
|
-
|
63
|
-
{ status_code: status_code, status_time: status_time }
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def status_code
|
68
|
-
info.fetch(:status_code)
|
44
|
+
@status_code, @status_time = status_from_latest_current_milestone
|
69
45
|
end
|
70
46
|
|
71
47
|
# @param [Boolean] include_time
|
72
48
|
# @return [String] single composed status from status_info
|
73
49
|
def display(include_time: false)
|
74
|
-
status_time = info[:status_time]
|
75
|
-
|
76
50
|
# use the translation table to get the appropriate verbage for the latest step
|
77
51
|
result = "v#{version} #{STATUS_CODE_DISP_TXT[status_code]}"
|
78
52
|
result += " #{format_date(status_time)}" if include_time
|
@@ -89,7 +63,19 @@ module Dor
|
|
89
63
|
|
90
64
|
private
|
91
65
|
|
92
|
-
attr_reader :druid, :version, :lifecycle_routes
|
66
|
+
attr_reader :druid, :version, :lifecycle_routes, :status_time
|
67
|
+
|
68
|
+
def status_from_latest_current_milestone
|
69
|
+
# if we have an accessioned milestone, this is the last possible step and should be the status regardless of timestamp
|
70
|
+
return [STEPS['accessioned'], latest_accessioned_milestone[:at].utc.xmlschema] if currently_accessioned?
|
71
|
+
|
72
|
+
return [0, nil] if latest_current_milestone.nil?
|
73
|
+
|
74
|
+
[
|
75
|
+
STEPS.fetch(latest_current_milestone.fetch(:milestone), 0),
|
76
|
+
latest_current_milestone[:at].utc.xmlschema
|
77
|
+
]
|
78
|
+
end
|
93
79
|
|
94
80
|
# @return [String] text translation of the status code, minus any trailing parenthetical explanation
|
95
81
|
# e.g. 'In accessioning (described)' and 'In accessioning (described, published)' both return 'In accessioning'
|
@@ -98,19 +84,33 @@ module Dor
|
|
98
84
|
end
|
99
85
|
|
100
86
|
def current_milestones
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
87
|
+
milestones
|
88
|
+
# milestone name must be in list of known steps
|
89
|
+
.select { |m| STEPS.key?(m[:milestone]) }
|
90
|
+
# registered milestone is only valid for v1
|
91
|
+
.reject { |m| m[:milestone] == 'registered' && version.to_i > 1 }
|
92
|
+
# Two possible ways the version can indicate the milestone is part of the current version:
|
93
|
+
# if m[:version] is nil, then the milestone is active (version 0 becoming version 1)
|
94
|
+
# if m[:version] is matches the current version, then the milestone is archived with the current version
|
95
|
+
.select { |m| m[:version].nil? || m[:version] == version }
|
96
|
+
end
|
97
|
+
|
98
|
+
def latest_current_milestone
|
99
|
+
current_milestones.max_by { |m| m[:at].utc.xmlschema }
|
100
|
+
end
|
101
|
+
|
102
|
+
def currently_accessioned?
|
103
|
+
current_milestones.any? { |m| m[:milestone] == 'accessioned' }
|
104
|
+
end
|
105
|
+
|
106
|
+
def latest_accessioned_milestone
|
107
|
+
current_milestones
|
108
|
+
.select { |m| m[:milestone] == 'accessioned' }
|
109
|
+
.max_by { |m| m[:at].utc.xmlschema }
|
110
110
|
end
|
111
111
|
|
112
|
-
# handles
|
113
|
-
#
|
112
|
+
# handles formatting UTC date/time to human readable
|
113
|
+
# TODO: bad form to hardcode TZ here.
|
114
114
|
def format_date(datetime)
|
115
115
|
d =
|
116
116
|
if datetime.is_a?(Time)
|
@@ -5,24 +5,26 @@ require 'spec_helper'
|
|
5
5
|
# This test can take up to 15s to run because it does retries with exponential backoff
|
6
6
|
RSpec.describe Dor::Workflow::Client::ConnectionFactory do
|
7
7
|
let(:mock_logger) { double('Logger', info: true, debug: true, warn: true) }
|
8
|
+
let(:client) { Dor::Workflow::Client.new url: 'http://example.com', logger: mock_logger }
|
8
9
|
|
9
10
|
let(:druid) { 'druid:123' }
|
10
11
|
let(:request_url) { "http://example.com/objects/#{druid}/workflows/httpException?lane-id=default&version=1" }
|
12
|
+
|
11
13
|
before do
|
12
14
|
stub_request(:post, request_url)
|
13
15
|
.to_return(status: 500, body: 'Internal error', headers: {})
|
16
|
+
allow(mock_logger).to receive(:warn)
|
14
17
|
end
|
15
18
|
|
16
|
-
let(:client) { Dor::Workflow::Client.new url: 'http://example.com', logger: mock_logger }
|
17
|
-
|
18
19
|
describe '#create_workflow_by_name' do
|
19
20
|
subject(:request) { client.create_workflow_by_name(druid, 'httpException', version: '1') }
|
21
|
+
|
20
22
|
it 'logs an error and retry upon a targeted Faraday exception' do
|
21
|
-
expect
|
23
|
+
expect { request }.to raise_error Dor::WorkflowException
|
24
|
+
expect(mock_logger).to have_received(:warn)
|
22
25
|
.with("retrying connection (1) to #{request_url}: (Faraday::RetriableResponse) 500")
|
23
|
-
expect(mock_logger).to
|
26
|
+
expect(mock_logger).to have_received(:warn)
|
24
27
|
.with("retrying connection (2) to #{request_url}: (Faraday::RetriableResponse) 500")
|
25
|
-
expect { request }.to raise_error Dor::WorkflowException
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
@@ -6,6 +6,7 @@ RSpec.describe Dor::Workflow::Client::Status do
|
|
6
6
|
subject(:instance) do
|
7
7
|
described_class.new(druid: druid, version: version, lifecycle_routes: lifecycle_routes)
|
8
8
|
end
|
9
|
+
|
9
10
|
let(:druid) { 'druid:ab123cd4567' }
|
10
11
|
let(:version) { '2' }
|
11
12
|
let(:lifecycle_routes) { Dor::Workflow::Client::LifecycleRoutes.new(requestor: requestor) }
|
@@ -14,7 +15,7 @@ RSpec.describe Dor::Workflow::Client::Status do
|
|
14
15
|
describe '#display' do
|
15
16
|
subject(:status) { instance.display }
|
16
17
|
|
17
|
-
|
18
|
+
describe 'for gv054hp4128' do
|
18
19
|
context 'when current version is published, but does not have a version attribute' do
|
19
20
|
let(:xml) do
|
20
21
|
'<?xml version="1.0" encoding="UTF-8"?>
|
@@ -51,7 +52,7 @@ RSpec.describe Dor::Workflow::Client::Status do
|
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
54
|
-
|
55
|
+
describe 'for bd504dj1946' do
|
55
56
|
let(:xml) do
|
56
57
|
'<?xml version="1.0"?>
|
57
58
|
<lifecycle objectId="druid:bd504dj1946">
|
@@ -100,7 +101,9 @@ RSpec.describe Dor::Workflow::Client::Status do
|
|
100
101
|
end
|
101
102
|
end
|
102
103
|
|
103
|
-
context '
|
104
|
+
context 'with an accessioned step with the exact same timestamp as the deposited step' do
|
105
|
+
subject(:status) { instance.display(include_time: true) }
|
106
|
+
|
104
107
|
let(:xml) do
|
105
108
|
'<?xml version="1.0"?>
|
106
109
|
<lifecycle objectId="druid:bd504dj1946">
|
@@ -120,14 +123,14 @@ RSpec.describe Dor::Workflow::Client::Status do
|
|
120
123
|
</lifecycle>'
|
121
124
|
end
|
122
125
|
|
123
|
-
subject(:status) { instance.display(include_time: true) }
|
124
|
-
|
125
126
|
it 'has the correct status of accessioned (v2) object' do
|
126
127
|
expect(status).to eq('v2 Accessioned 2013-10-01 07:10PM')
|
127
128
|
end
|
128
129
|
end
|
129
130
|
|
130
|
-
context '
|
131
|
+
context 'with an accessioned step with an ealier timestamp than the deposited step' do
|
132
|
+
subject(:status) { instance.display(include_time: true) }
|
133
|
+
|
131
134
|
let(:xml) do
|
132
135
|
'<?xml version="1.0"?>
|
133
136
|
<lifecycle objectId="druid:bd504dj1946">
|
@@ -147,14 +150,14 @@ RSpec.describe Dor::Workflow::Client::Status do
|
|
147
150
|
</lifecycle>'
|
148
151
|
end
|
149
152
|
|
150
|
-
subject(:status) { instance.display(include_time: true) }
|
151
|
-
|
152
153
|
it 'has the correct status of accessioned (v2) object' do
|
153
154
|
expect(status).to eq('v2 Accessioned 2013-09-01 07:10PM')
|
154
155
|
end
|
155
156
|
end
|
156
157
|
|
157
|
-
context '
|
158
|
+
context 'with a deposited step for a non-accessioned object' do
|
159
|
+
subject(:status) { instance.display(include_time: true) }
|
160
|
+
|
158
161
|
let(:xml) do
|
159
162
|
'<?xml version="1.0"?>
|
160
163
|
<lifecycle objectId="druid:bd504dj1946">
|
@@ -173,8 +176,6 @@ RSpec.describe Dor::Workflow::Client::Status do
|
|
173
176
|
</lifecycle>'
|
174
177
|
end
|
175
178
|
|
176
|
-
subject(:status) { instance.display(include_time: true) }
|
177
|
-
|
178
179
|
it 'has the correct status of deposited (v2) object' do
|
179
180
|
expect(status).to eq('v2 In accessioning (described, published, deposited) 2013-10-01 07:10PM')
|
180
181
|
end
|
@@ -183,6 +184,7 @@ RSpec.describe Dor::Workflow::Client::Status do
|
|
183
184
|
|
184
185
|
describe '#display_simplified' do
|
185
186
|
subject(:status) { instance.display_simplified }
|
187
|
+
|
186
188
|
let(:xml) do
|
187
189
|
'<?xml version="1.0" encoding="UTF-8"?>
|
188
190
|
<lifecycle objectId="druid:gv054hp4128">
|
@@ -86,6 +86,7 @@ RSpec.describe Dor::Workflow::Client::WorkflowRoutes do
|
|
86
86
|
before do
|
87
87
|
allow(mock_requestor).to receive(:request).and_raise(Dor::WorkflowException, 'status 400')
|
88
88
|
end
|
89
|
+
|
89
90
|
it 'raises an exception' do
|
90
91
|
expect { routes.update_status(druid: druid, workflow: 'errorWF', process: 'registrar-approval', status: 'completed') }.to raise_error(Dor::WorkflowException, /status 400/)
|
91
92
|
end
|
@@ -128,6 +129,7 @@ RSpec.describe Dor::Workflow::Client::WorkflowRoutes do
|
|
128
129
|
before do
|
129
130
|
allow(mock_requestor).to receive(:request).and_raise(Dor::WorkflowException, 'status 400')
|
130
131
|
end
|
132
|
+
|
131
133
|
it 'raises an exception' do
|
132
134
|
expect { routes.update_error_status(druid: druid, workflow: 'errorWF', process: 'registrar-approval', error_msg: 'broken') }.to raise_error(Dor::WorkflowException, /status 400/)
|
133
135
|
end
|
@@ -138,19 +140,7 @@ RSpec.describe Dor::Workflow::Client::WorkflowRoutes do
|
|
138
140
|
subject(:delete_all_workflows) do
|
139
141
|
routes.delete_all_workflows(pid: 'druid:mw971zk1113')
|
140
142
|
end
|
141
|
-
let(:mock_requestor) { instance_double(Dor::Workflow::Client::Requestor, request: nil) }
|
142
143
|
|
143
|
-
it 'sends a delete request' do
|
144
|
-
delete_all_workflows
|
145
|
-
expect(mock_requestor).to have_received(:request)
|
146
|
-
.with('objects/druid:mw971zk1113/workflows', 'delete')
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
describe '#delete_all_workflows' do
|
151
|
-
subject(:delete_all_workflows) do
|
152
|
-
routes.delete_all_workflows(pid: 'druid:mw971zk1113')
|
153
|
-
end
|
154
144
|
let(:mock_requestor) { instance_double(Dor::Workflow::Client::Requestor, request: nil) }
|
155
145
|
|
156
146
|
it 'sends a delete request' do
|
@@ -175,11 +165,14 @@ RSpec.describe Dor::Workflow::Client::WorkflowRoutes do
|
|
175
165
|
allow(routes).to receive(:all_workflows_xml) { xml }
|
176
166
|
end
|
177
167
|
|
178
|
-
it '
|
168
|
+
it 'returns the workflows' do
|
179
169
|
expect(routes.all_workflows(pid: 'druid:mw971zk1113')).to be_kind_of Dor::Workflow::Response::Workflows
|
180
170
|
end
|
181
171
|
end
|
182
172
|
|
183
173
|
describe '#create_workflow_by_name' do
|
174
|
+
it 'need to write these specs', skip: 'need to write specs' do
|
175
|
+
# something
|
176
|
+
end
|
184
177
|
end
|
185
178
|
end
|
@@ -9,6 +9,7 @@ RSpec.describe Dor::Workflow::Client::WorkflowTemplate do
|
|
9
9
|
|
10
10
|
describe '#retrieve' do
|
11
11
|
subject(:workflow_template) { routes.retrieve('accessionWF') }
|
12
|
+
|
12
13
|
let(:data) { '{"processes":[{"name":"start-assembly"},{"name":"content-metadata-create"}]}' }
|
13
14
|
|
14
15
|
it 'returns a workflow template' do
|
@@ -20,6 +21,7 @@ RSpec.describe Dor::Workflow::Client::WorkflowTemplate do
|
|
20
21
|
|
21
22
|
describe '#all' do
|
22
23
|
subject(:workflow_templates) { routes.all }
|
24
|
+
|
23
25
|
let(:data) { '["assemblyWF","registrationWF"]' }
|
24
26
|
|
25
27
|
it 'returns a list of templates' do
|
@@ -14,6 +14,7 @@ RSpec.describe Dor::Workflow::Client do
|
|
14
14
|
</workflow>
|
15
15
|
EOXML
|
16
16
|
end
|
17
|
+
let(:client) { described_class.new connection: mock_http_connection, logger: mock_logger }
|
17
18
|
|
18
19
|
let(:wf_xml_label) do
|
19
20
|
<<~EOXML
|
@@ -47,10 +48,9 @@ RSpec.describe Dor::Workflow::Client do
|
|
47
48
|
@druid = 'druid:123'
|
48
49
|
end
|
49
50
|
|
50
|
-
let(:client) { described_class.new connection: mock_http_connection, logger: mock_logger }
|
51
|
-
|
52
51
|
describe '#connection' do
|
53
52
|
subject(:conn) { client.requestor.connection }
|
53
|
+
|
54
54
|
let(:client) { described_class.new url: 'http://example.com', timeout: 99, logger: mock_logger }
|
55
55
|
|
56
56
|
it 'has a timeout' do
|
@@ -89,7 +89,8 @@ RSpec.describe Dor::Workflow::Client do
|
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'sets the lane_id param' do
|
92
|
-
|
92
|
+
# if the stub isn't correct (params), it will raise an error
|
93
|
+
expect { client.create_workflow_by_name(@druid, 'laneIdWF', lane_id: 'foo_lane', version: 1) }.not_to raise_error
|
93
94
|
end
|
94
95
|
end
|
95
96
|
|
@@ -101,7 +102,8 @@ RSpec.describe Dor::Workflow::Client do
|
|
101
102
|
end
|
102
103
|
|
103
104
|
it 'sets the version param if provided in options hash' do
|
104
|
-
|
105
|
+
# if the stub isn't correct (options hash), it will raise an error
|
106
|
+
expect { client.create_workflow_by_name(@druid, 'versionWF', version: 2) }.not_to raise_error
|
105
107
|
end
|
106
108
|
end
|
107
109
|
end
|
@@ -145,7 +147,16 @@ RSpec.describe Dor::Workflow::Client do
|
|
145
147
|
end
|
146
148
|
|
147
149
|
describe '#workflow_status' do
|
150
|
+
subject(:workflow_status) { client.workflow_status(druid: druid, workflow: workflow_name, process: step_name) }
|
151
|
+
|
148
152
|
let(:repo) { nil }
|
153
|
+
let(:step_name) { 'registrar-approval' }
|
154
|
+
let(:workflow_name) { 'etdSubmitWF' }
|
155
|
+
let(:status) { 200 }
|
156
|
+
let(:response) do
|
157
|
+
[status, {}, xml]
|
158
|
+
end
|
159
|
+
let(:xml) { '' }
|
149
160
|
let(:druid) { @druid }
|
150
161
|
let(:stubs) do
|
151
162
|
Faraday::Adapter::Test::Stubs.new do |stub|
|
@@ -155,22 +166,13 @@ RSpec.describe Dor::Workflow::Client do
|
|
155
166
|
end
|
156
167
|
end
|
157
168
|
|
158
|
-
subject { client.workflow_status(druid: druid, workflow: workflow_name, process: step_name) }
|
159
|
-
let(:step_name) { 'registrar-approval' }
|
160
|
-
let(:workflow_name) { 'etdSubmitWF' }
|
161
|
-
let(:status) { 200 }
|
162
|
-
let(:response) do
|
163
|
-
[status, {}, xml]
|
164
|
-
end
|
165
|
-
let(:xml) { '' }
|
166
|
-
|
167
169
|
context 'when a single result is returned' do
|
168
170
|
let(:xml) do
|
169
171
|
'<workflow><process name="registrar-approval" status="completed" /></workflow>'
|
170
172
|
end
|
171
173
|
|
172
174
|
it 'returns status as a string' do
|
173
|
-
expect(
|
175
|
+
expect(workflow_status).to eq('completed')
|
174
176
|
end
|
175
177
|
end
|
176
178
|
|
@@ -181,7 +183,7 @@ RSpec.describe Dor::Workflow::Client do
|
|
181
183
|
end
|
182
184
|
|
183
185
|
it 'returns the status for the highest version' do
|
184
|
-
expect(
|
186
|
+
expect(workflow_status).to eq('waiting')
|
185
187
|
end
|
186
188
|
end
|
187
189
|
|
@@ -189,7 +191,7 @@ RSpec.describe Dor::Workflow::Client do
|
|
189
191
|
let(:status) { 404 }
|
190
192
|
|
191
193
|
it 'throws the missing workflow exception' do
|
192
|
-
expect {
|
194
|
+
expect { workflow_status }.to raise_error Dor::MissingWorkflowException
|
193
195
|
end
|
194
196
|
end
|
195
197
|
|
@@ -197,7 +199,7 @@ RSpec.describe Dor::Workflow::Client do
|
|
197
199
|
let(:status) { 422 }
|
198
200
|
|
199
201
|
it 'throws an exception' do
|
200
|
-
expect {
|
202
|
+
expect { workflow_status }.to raise_error Dor::WorkflowException
|
201
203
|
end
|
202
204
|
end
|
203
205
|
|
@@ -207,7 +209,7 @@ RSpec.describe Dor::Workflow::Client do
|
|
207
209
|
end
|
208
210
|
|
209
211
|
it 'throws an exception' do
|
210
|
-
expect {
|
212
|
+
expect { workflow_status }.to raise_error Dor::WorkflowException, "Unable to parse response:\nsomething not xml"
|
211
213
|
end
|
212
214
|
end
|
213
215
|
|
@@ -218,7 +220,7 @@ RSpec.describe Dor::Workflow::Client do
|
|
218
220
|
let(:step_name) { 'publish' }
|
219
221
|
|
220
222
|
it 'returns nil' do
|
221
|
-
expect(
|
223
|
+
expect(workflow_status).to be_nil
|
222
224
|
end
|
223
225
|
end
|
224
226
|
end
|
@@ -323,8 +325,8 @@ RSpec.describe Dor::Workflow::Client do
|
|
323
325
|
end
|
324
326
|
end
|
325
327
|
|
326
|
-
|
327
|
-
before
|
328
|
+
describe '#objects_for_workstep' do
|
329
|
+
before do
|
328
330
|
@workflow = 'googleScannedBookWF'
|
329
331
|
@completed = 'google-download'
|
330
332
|
@waiting = 'process-content'
|
@@ -353,8 +355,8 @@ RSpec.describe Dor::Workflow::Client do
|
|
353
355
|
end
|
354
356
|
end
|
355
357
|
|
356
|
-
context 'a query using qualified workflow names for completed and waiting' do
|
357
|
-
before
|
358
|
+
context 'with a query using qualified workflow names for completed and waiting' do
|
359
|
+
before do
|
358
360
|
@qualified_waiting = "#{@workflow}:#{@waiting}"
|
359
361
|
@qualified_completed = "#{@workflow}:#{@completed}"
|
360
362
|
end
|
@@ -376,24 +378,28 @@ RSpec.describe Dor::Workflow::Client do
|
|
376
378
|
let(:laneid) { 'default' }
|
377
379
|
end
|
378
380
|
end
|
381
|
+
|
379
382
|
describe 'explicit lane_id' do
|
380
383
|
it_behaves_like 'lane-aware' do
|
381
384
|
let(:laneid) { 'lane1' }
|
382
385
|
end
|
383
386
|
end
|
384
387
|
|
385
|
-
context 'URI string creation' do
|
386
|
-
before
|
388
|
+
context 'with URI string creation' do
|
389
|
+
before do
|
387
390
|
@xml = %(<objects count="1"><object id="druid:ab123de4567"/></objects>)
|
388
391
|
end
|
392
|
+
|
389
393
|
it 'with only one completed step passed in as a String' do
|
390
394
|
allow(mock_http_connection).to receive(:get).with("workflow_queue?waiting=#{@qualified_waiting}&completed=#{@qualified_completed}&lane-id=default").and_return(double(Faraday::Response, body: @xml))
|
391
395
|
expect(client.objects_for_workstep(@qualified_completed, @qualified_waiting)).to eq(['druid:ab123de4567'])
|
392
396
|
end
|
397
|
+
|
393
398
|
it 'without any completed steps, only waiting' do
|
394
399
|
allow(mock_http_connection).to receive(:get).with("workflow_queue?waiting=#{@qualified_waiting}&lane-id=default").and_return(double(Faraday::Response, body: @xml))
|
395
400
|
expect(client.objects_for_workstep(nil, @qualified_waiting)).to eq(['druid:ab123de4567'])
|
396
401
|
end
|
402
|
+
|
397
403
|
it 'same but with lane_id' do
|
398
404
|
allow(mock_http_connection).to receive(:get).with("workflow_queue?waiting=#{@qualified_waiting}&lane-id=lane1").and_return(double(Faraday::Response, body: @xml))
|
399
405
|
expect(client.objects_for_workstep(nil, @qualified_waiting, 'lane1')).to eq(['druid:ab123de4567'])
|
@@ -402,8 +408,8 @@ RSpec.describe Dor::Workflow::Client do
|
|
402
408
|
end
|
403
409
|
end
|
404
410
|
|
405
|
-
context '
|
406
|
-
before
|
411
|
+
context 'when empty workflow queue' do
|
412
|
+
before do
|
407
413
|
@workflow = 'googleScannedBookWF'
|
408
414
|
@completed = 'google-download'
|
409
415
|
@waiting = 'process-content'
|
@@ -422,8 +428,8 @@ RSpec.describe Dor::Workflow::Client do
|
|
422
428
|
end
|
423
429
|
end
|
424
430
|
|
425
|
-
context '
|
426
|
-
before
|
431
|
+
context 'when errored workflow steps' do
|
432
|
+
before do
|
427
433
|
@workflow = 'accessionWF'
|
428
434
|
@step = 'publish'
|
429
435
|
end
|
@@ -454,7 +460,7 @@ RSpec.describe Dor::Workflow::Client do
|
|
454
460
|
end
|
455
461
|
|
456
462
|
describe '#count_queued_for_workstep' do
|
457
|
-
before
|
463
|
+
before do
|
458
464
|
@workflow = 'accessionWF'
|
459
465
|
@step = 'publish'
|
460
466
|
end
|
@@ -477,7 +483,7 @@ RSpec.describe Dor::Workflow::Client do
|
|
477
483
|
end
|
478
484
|
|
479
485
|
describe '#count_objects_in_step' do
|
480
|
-
before
|
486
|
+
before do
|
481
487
|
@workflow = 'sdrIngestWF'
|
482
488
|
@step = 'start-ingest'
|
483
489
|
@type = 'waiting'
|
@@ -506,12 +512,15 @@ RSpec.describe Dor::Workflow::Client do
|
|
506
512
|
stub.delete(url) { |_env| [202, {}, ''] }
|
507
513
|
end
|
508
514
|
end
|
509
|
-
|
510
515
|
let(:url) { "/objects/#{@druid}/workflows/accessionWF?version=5" }
|
511
516
|
|
517
|
+
before do
|
518
|
+
allow(mock_http_connection).to receive(:delete).with(url).and_call_original
|
519
|
+
end
|
520
|
+
|
512
521
|
it 'sends a delete request to the workflow service' do
|
513
|
-
expect(mock_http_connection).to receive(:delete).with(url).and_call_original
|
514
522
|
client.delete_workflow(druid: @druid, workflow: 'accessionWF', version: 5)
|
523
|
+
expect(mock_http_connection).to have_received(:delete).with(url)
|
515
524
|
end
|
516
525
|
end
|
517
526
|
|
@@ -3,9 +3,10 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Dor::Workflow::Response::Process do
|
6
|
-
let(:parent) { Dor::Workflow::Response::Workflow.new(xml: xml) }
|
7
6
|
subject(:instance) { parent.process_for_recent_version(name: 'start-assembly') }
|
8
7
|
|
8
|
+
let(:parent) { Dor::Workflow::Response::Workflow.new(xml: xml) }
|
9
|
+
|
9
10
|
describe '#pid' do
|
10
11
|
subject { instance.pid }
|
11
12
|
|
@@ -16,6 +17,7 @@ RSpec.describe Dor::Workflow::Response::Process do
|
|
16
17
|
</workflow>
|
17
18
|
XML
|
18
19
|
end
|
20
|
+
|
19
21
|
it { is_expected.to eq 'druid:mw971zk1113' }
|
20
22
|
end
|
21
23
|
|
@@ -29,6 +31,7 @@ RSpec.describe Dor::Workflow::Response::Process do
|
|
29
31
|
</workflow>
|
30
32
|
XML
|
31
33
|
end
|
34
|
+
|
32
35
|
it { is_expected.to eq 'assemblyWF' }
|
33
36
|
end
|
34
37
|
|
@@ -42,6 +45,7 @@ RSpec.describe Dor::Workflow::Response::Process do
|
|
42
45
|
</workflow>
|
43
46
|
XML
|
44
47
|
end
|
48
|
+
|
45
49
|
it { is_expected.to eq 'start-assembly' }
|
46
50
|
end
|
47
51
|
|
@@ -55,6 +59,7 @@ RSpec.describe Dor::Workflow::Response::Process do
|
|
55
59
|
</workflow>
|
56
60
|
XML
|
57
61
|
end
|
62
|
+
|
58
63
|
it { is_expected.to eq 'default' }
|
59
64
|
end
|
60
65
|
end
|
@@ -14,6 +14,7 @@ RSpec.describe Dor::Workflow::Response::Workflow do
|
|
14
14
|
</workflow>
|
15
15
|
XML
|
16
16
|
end
|
17
|
+
|
17
18
|
it { is_expected.to eq 'druid:mw971zk1113' }
|
18
19
|
end
|
19
20
|
|
@@ -26,11 +27,13 @@ RSpec.describe Dor::Workflow::Response::Workflow do
|
|
26
27
|
</workflow>
|
27
28
|
XML
|
28
29
|
end
|
30
|
+
|
29
31
|
it { is_expected.to eq 'assemblyWF' }
|
30
32
|
end
|
31
33
|
|
32
34
|
describe '#complete?' do
|
33
35
|
subject { instance.complete? }
|
36
|
+
|
34
37
|
context 'when all steps are complete' do
|
35
38
|
let(:xml) do
|
36
39
|
<<~XML
|
@@ -40,6 +43,7 @@ RSpec.describe Dor::Workflow::Response::Workflow do
|
|
40
43
|
</workflow>
|
41
44
|
XML
|
42
45
|
end
|
46
|
+
|
43
47
|
it { is_expected.to be true }
|
44
48
|
end
|
45
49
|
|
@@ -52,6 +56,7 @@ RSpec.describe Dor::Workflow::Response::Workflow do
|
|
52
56
|
</workflow>
|
53
57
|
XML
|
54
58
|
end
|
59
|
+
|
55
60
|
it { is_expected.to be false }
|
56
61
|
end
|
57
62
|
end
|
@@ -68,6 +73,7 @@ RSpec.describe Dor::Workflow::Response::Workflow do
|
|
68
73
|
</workflow>
|
69
74
|
XML
|
70
75
|
end
|
76
|
+
|
71
77
|
it { is_expected.to be false }
|
72
78
|
end
|
73
79
|
|
@@ -81,6 +87,7 @@ RSpec.describe Dor::Workflow::Response::Workflow do
|
|
81
87
|
</workflow>
|
82
88
|
XML
|
83
89
|
end
|
90
|
+
|
84
91
|
it { is_expected.to be true }
|
85
92
|
end
|
86
93
|
end
|
@@ -14,11 +14,12 @@ RSpec.describe Dor::Workflow::Response::Workflows do
|
|
14
14
|
</workflows>
|
15
15
|
XML
|
16
16
|
end
|
17
|
+
|
17
18
|
it { is_expected.to eq 'druid:mw971zk1113' }
|
18
19
|
end
|
19
20
|
|
20
21
|
describe '#workflows' do
|
21
|
-
subject { instance.workflows }
|
22
|
+
subject(:workflows) { instance.workflows }
|
22
23
|
|
23
24
|
let(:xml) do
|
24
25
|
<<~XML
|
@@ -32,8 +33,8 @@ RSpec.describe Dor::Workflow::Response::Workflows do
|
|
32
33
|
end
|
33
34
|
|
34
35
|
it 'has children' do
|
35
|
-
expect(
|
36
|
-
expect(
|
36
|
+
expect(workflows).to all(be_kind_of Dor::Workflow::Response::Workflow)
|
37
|
+
expect(workflows.map(&:workflow_name)).to eq %w[assemblyWF sdrPreservationWF]
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dor-workflow-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Willy Mene
|
8
8
|
- Darren Hardy
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-06-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -249,23 +249,23 @@ files:
|
|
249
249
|
- lib/dor/workflow/response/workflow.rb
|
250
250
|
- lib/dor/workflow/response/workflows.rb
|
251
251
|
- lib/dor/workflow_exception.rb
|
252
|
-
- spec/
|
253
|
-
- spec/
|
254
|
-
- spec/
|
252
|
+
- spec/dor/workflow/client/connection_factory_spec.rb
|
253
|
+
- spec/dor/workflow/client/lifecycle_routes_spec.rb
|
254
|
+
- spec/dor/workflow/client/requestor_spec.rb
|
255
|
+
- spec/dor/workflow/client/status_spec.rb
|
256
|
+
- spec/dor/workflow/client/version_routes_spec.rb
|
257
|
+
- spec/dor/workflow/client/workflow_routes_spec.rb
|
258
|
+
- spec/dor/workflow/client/workflow_template_spec.rb
|
259
|
+
- spec/dor/workflow/client_spec.rb
|
260
|
+
- spec/dor/workflow/response/process_spec.rb
|
261
|
+
- spec/dor/workflow/response/workflow_spec.rb
|
262
|
+
- spec/dor/workflow/response/workflows_spec.rb
|
255
263
|
- spec/spec_helper.rb
|
256
|
-
- spec/workflow/client/connection_factory_spec.rb
|
257
|
-
- spec/workflow/client/lifecycle_routes_spec.rb
|
258
|
-
- spec/workflow/client/requestor_spec.rb
|
259
|
-
- spec/workflow/client/status_spec.rb
|
260
|
-
- spec/workflow/client/version_routes_spec.rb
|
261
|
-
- spec/workflow/client/workflow_routes_spec.rb
|
262
|
-
- spec/workflow/client/workflow_template_spec.rb
|
263
|
-
- spec/workflow/client_spec.rb
|
264
264
|
homepage: https://consul.stanford.edu/display/DOR/DOR+services#DORservices-initializeworkflow
|
265
265
|
licenses: []
|
266
266
|
metadata:
|
267
267
|
rubygems_mfa_required: 'true'
|
268
|
-
post_install_message:
|
268
|
+
post_install_message:
|
269
269
|
rdoc_options: []
|
270
270
|
require_paths:
|
271
271
|
- lib
|
@@ -273,15 +273,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
273
273
|
requirements:
|
274
274
|
- - ">="
|
275
275
|
- !ruby/object:Gem::Version
|
276
|
-
version: '
|
276
|
+
version: '3.0'
|
277
277
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
278
278
|
requirements:
|
279
279
|
- - ">="
|
280
280
|
- !ruby/object:Gem::Version
|
281
281
|
version: '0'
|
282
282
|
requirements: []
|
283
|
-
rubygems_version: 3.
|
284
|
-
signing_key:
|
283
|
+
rubygems_version: 3.4.10
|
284
|
+
signing_key:
|
285
285
|
specification_version: 4
|
286
286
|
summary: Provides convenience methods to work with the DOR Workflow Service
|
287
287
|
test_files: []
|
@@ -10,6 +10,8 @@ RSpec.describe Dor::Workflow::Client::LifecycleRoutes do
|
|
10
10
|
let(:druid) { 'druid:gv054hp4128' }
|
11
11
|
|
12
12
|
describe '#milestones' do
|
13
|
+
subject(:milestones) { routes.milestones(druid: druid) }
|
14
|
+
|
13
15
|
let(:ng_xml) { Nokogiri::XML(xml) }
|
14
16
|
let(:xml) do
|
15
17
|
'<?xml version="1.0" encoding="UTF-8"?><lifecycle objectId="druid:gv054hp4128"><milestone date="2012-01-26T21:06:54-0800" version="2">published</milestone></lifecycle>'
|
@@ -19,8 +21,6 @@ RSpec.describe Dor::Workflow::Client::LifecycleRoutes do
|
|
19
21
|
allow(routes).to receive(:query_lifecycle).and_return(ng_xml)
|
20
22
|
end
|
21
23
|
|
22
|
-
subject(:milestones) { routes.milestones(druid: druid) }
|
23
|
-
|
24
24
|
it 'includes the version in with the milestones' do
|
25
25
|
expect(milestones.first[:milestone]).to eq('published')
|
26
26
|
expect(milestones.first[:version]).to eq('2')
|
File without changes
|
File without changes
|