dor-workflow-client 3.14.0 → 3.15.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 999836d9819299630a505d4f09ec8e8fd9a054fe8a7718b09096a7e3aae3b4cb
|
4
|
+
data.tar.gz: 2aabfa8b7212d6b59a63b43c24b07d11d350ab25138b9888241a86d27a21282e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e79fc455a8757224ebc51ad4fb2c28d59801d0be5c7283cc393011ae374cb21ffb762bc52e21838317c4abb71b17ec79269c028aac0fc0dfcc425ecaaf7a904e
|
7
|
+
data.tar.gz: ca91b5a46d08c5a2519d958d18ee55f0d201c13c6856b542a9ff0d5bef58ba80ff82e3c253fc5e323bbc3fac6ba866e99d7945b2392e682b92fb151d68d840d1
|
@@ -39,10 +39,19 @@ module Dor
|
|
39
39
|
ng_xml.xpath('/workflow/process').empty?
|
40
40
|
end
|
41
41
|
|
42
|
+
def complete?
|
43
|
+
ng_xml.xpath("/workflow/process[@version=#{version}]/@status").map(&:value).all? { |p| %w[skipped completed].include?(p) }
|
44
|
+
end
|
45
|
+
|
42
46
|
attr_reader :xml
|
43
47
|
|
44
48
|
private
|
45
49
|
|
50
|
+
# Return the max version in this workflow document
|
51
|
+
def version
|
52
|
+
ng_xml.xpath('/workflow/process/@version').map { |attr| attr.value.to_i }.max
|
53
|
+
end
|
54
|
+
|
46
55
|
def workflow
|
47
56
|
ng_xml.at_xpath('workflow')
|
48
57
|
end
|
@@ -41,6 +41,33 @@ RSpec.describe Dor::Workflow::Response::Workflow do
|
|
41
41
|
it { is_expected.to eq 'dor' }
|
42
42
|
end
|
43
43
|
|
44
|
+
describe '#complete?' do
|
45
|
+
subject { instance.complete? }
|
46
|
+
context 'when all steps are complete' do
|
47
|
+
let(:xml) do
|
48
|
+
<<~XML
|
49
|
+
<workflow repository="dor" objectId="druid:mw971zk1113" id="assemblyWF">
|
50
|
+
<process version="1" laneId="default" elapsed="0.0" attempts="1" datetime="2013-02-18T14:40:25-0800" status="completed" name="start-assembly"/>
|
51
|
+
<process version="1" laneId="default" elapsed="0.509" attempts="1" datetime="2013-02-18T14:42:24-0800" status="completed" name="jp2-create"/>
|
52
|
+
</workflow>
|
53
|
+
XML
|
54
|
+
end
|
55
|
+
it { is_expected.to be true }
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'when some steps are not complete' do
|
59
|
+
let(:xml) do
|
60
|
+
<<~XML
|
61
|
+
<workflow repository="dor" objectId="druid:mw971zk1113" id="assemblyWF">
|
62
|
+
<process version="1" laneId="default" elapsed="0.0" attempts="1" datetime="2013-02-18T14:40:25-0800" status="completed" name="start-assembly"/>
|
63
|
+
<process version="1" laneId="default" elapsed="0.509" attempts="1" datetime="2013-02-18T14:42:24-0800" status="waiting" name="jp2-create"/>
|
64
|
+
</workflow>
|
65
|
+
XML
|
66
|
+
end
|
67
|
+
it { is_expected.to be false }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
44
71
|
describe '#active?' do
|
45
72
|
subject { instance.active_for?(version: 2) }
|
46
73
|
|