libis-workflow-mongoid 2.0.beta.8 → 2.0.beta.10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cfa94b307591f08d69fad83f79bf8807c56037fd
4
- data.tar.gz: d484aa41a3da41c6d6c282b073231b17faa6948d
3
+ metadata.gz: 72052cd9486d8810a3435fffb93cec07183a3660
4
+ data.tar.gz: 3599ae44df1eec26ff057e6c8f41d3e31aba8acb
5
5
  SHA512:
6
- metadata.gz: 70bf6048529e08dc5cf543788af85d9a8fcea6d36c90ad16d5a6b41c11644abbd38de87557a8d7ae3ae4aa8826de16298d6197811a92a065e7fb302cf2ac506f
7
- data.tar.gz: 8cde72beefe397820d0eed41c70218469f93523712ab12c8beff27b89c685105279229ae2f71af635a7023b8589f59a34954314b2c0b707f0dd82f7411633d2e
6
+ metadata.gz: 4ca524054dd5a6224d420bd4669ccc2d4d6b712bbf067083b2fa4fb5b58463e343a0e13a4f8dba1a17a68f3dce7d1ae9839467b858aaba71000a320032acb598
7
+ data.tar.gz: 75cf33dad01233954473c2fc2584dbc972f74b0779a62795b6caa1b0f01ce0bb93a6e456cfa91c47c6dc5d469def6937fe00c2afa896bdb2db0ea8348947b213
data/.travis.yml CHANGED
@@ -1,34 +1,33 @@
1
1
  language: ruby
2
+ sudo: false
3
+ bundler_args: --without development
2
4
  cache: bundler
3
- branches:
4
- only:
5
- - master
6
5
  rvm:
7
- - 1.9.3
8
6
  - 2.1.0
7
+ - 2.2.0
9
8
  - ruby-head
10
- - jruby-19mode
9
+ - jruby-9.0.1.0
11
10
  jdk:
12
11
  - openjdk7
13
12
  - oraclejdk7
14
13
  - oraclejdk8
15
- env:
16
- - MONGOID_VERSION=3
17
- - MONGOID_VERSION=4
18
14
  matrix:
19
15
  exclude:
20
- - rvm: 1.9.3
21
- jdk: oraclejdk7
22
- - rvm: 1.9.3
23
- jdk: oraclejdk8
24
16
  - rvm: 2.1.0
25
17
  jdk: oraclejdk7
26
18
  - rvm: 2.1.0
27
19
  jdk: oraclejdk8
20
+ - rvm: 2.2.0
21
+ jdk: oraclejdk7
22
+ - rvm: 2.2.0
23
+ jdk: oraclejdk8
28
24
  - rvm: ruby-head
29
25
  jdk: oraclejdk7
30
26
  - rvm: ruby-head
31
27
  jdk: oraclejdk8
28
+ branches:
29
+ only:
30
+ - master
32
31
  services:
33
32
  - mongodb
34
33
  before_script: ./.travis/db_prepare.sh
@@ -13,14 +13,31 @@ module Libis
13
13
  def self.included(klass)
14
14
  klass.class_eval do
15
15
  include ::Mongoid::Document
16
+ include ::Mongoid::Timestamps::Created::Short
16
17
  include ::Mongoid::Extensions::Hash::IndifferentAccess
17
18
  include ::Libis::Workflow::Mongoid::Sequence
18
- field :_id, type: Integer
19
+ field :_id, type: Integer, overwrite: true
19
20
  sequence :_id
20
- index created_at: 1
21
+ index c_at: 1
21
22
  end
22
23
  end
23
24
 
25
+ def dup
26
+ new_obj = self.class.new
27
+ new_obj.copy_attributes(self)
28
+ end
29
+
30
+ def copy_attributes(other)
31
+ self.set(
32
+ other.attributes.reject do |k, _|
33
+ %W(_id c_at).include? k.to_s
34
+ end.each_with_object({}) do |(k, v), h|
35
+ h[k] = v.duplicable? ? v.dup : v
36
+ end
37
+ )
38
+ self
39
+ end
40
+
24
41
  end
25
42
 
26
43
  end
@@ -19,6 +19,7 @@ module Libis
19
19
 
20
20
  Config.send(:define_method, :database_connect) do |config_file = './mongoid.yml', environment = nil|
21
21
  ::Mongoid.load! config_file, environment
22
+ ::Mongo::Logger.logger.level = Logger::ERROR
22
23
  end
23
24
 
24
25
  end
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+ require 'libis-workflow'
3
+ require 'libis/workflow/mongoid/base'
4
+
5
+ require 'mongoid/extensions/time_with_zone'
6
+
7
+ module Libis
8
+ module Workflow
9
+ module Mongoid
10
+
11
+ class LogEntry
12
+ include Libis::Workflow::Mongoid::Base
13
+
14
+ store_in collection: 'log'
15
+
16
+ field :severity, type: String
17
+ field :task, type: String, default: '*UNKNOWN*'
18
+ field :code, type: Integer
19
+ field :message, type: String
20
+ field :status, type: String
21
+
22
+ belongs_to :logger, polymorphic: true
23
+
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -18,13 +18,18 @@ module Libis
18
18
 
19
19
  store_in collection: 'workflow_runs'
20
20
 
21
- attr_accessor :tasks
22
-
23
21
  field :start_date, type: Time, default: -> { Time.now }
24
22
 
23
+ # def destroy
24
+ # self.items.each { |item| item.destroy }
25
+ # FileUtils.rmtree(work_dir) if Dir.exist?(work_dir)
26
+ # super
27
+ # end
28
+
25
29
  set_callback(:destroy, :before) do |document|
26
30
  wd = document.work_dir
27
31
  FileUtils.rmtree wd if Dir.exist? wd
32
+ document.items.each { |item| item.destroy! }
28
33
  end
29
34
 
30
35
  index start_date: 1
@@ -35,7 +40,7 @@ module Libis
35
40
 
36
41
  def klass.item_class(item_klass)
37
42
  has_many :items, inverse_of: :run, class_name: item_klass.to_s,
38
- dependent: :destroy, autosave: true, order: :created_at.asc
43
+ dependent: :destroy, autosave: true, order: :c_at.asc
39
44
  end
40
45
  end
41
46
  end
@@ -27,7 +27,8 @@ module Libis
27
27
  default: lambda {
28
28
  self.class.set_from_sequence(_field, prefix)
29
29
  },
30
- pre_processed: false
30
+ pre_processed: false,
31
+ overwrite: true
31
32
  )
32
33
  (options.keys - ::Mongoid::Fields::Validators::Macro::OPTIONS).each { |key| options.delete key }
33
34
  field(_field, options)
@@ -58,11 +59,15 @@ module Libis
58
59
 
59
60
  def sequences
60
61
  # mongo_session["#{self.collection_name.to_s}__seq"]
61
- mongo_session["__sequences__"]
62
+ mongo_client["__sequences__"]
62
63
  end
63
64
 
64
65
  def seq_upsert(counter_id, change)
65
- sequences.where(_id: counter_id).modify(change, upsert: true, new: true)
66
+ sequences.find_one_and_update({_id: counter_id},
67
+ change,
68
+ upsert: true,
69
+ return_document: :after
70
+ )
66
71
  end
67
72
 
68
73
  end
@@ -3,7 +3,7 @@
3
3
  module Libis
4
4
  module Workflow
5
5
  module Mongoid
6
- VERSION = '2.0.beta.8' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
6
+ VERSION = '2.0.beta.10' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
7
7
  end
8
8
  end
9
9
  end
@@ -14,24 +14,30 @@ module Libis
14
14
  store_in collection: 'workflow_items'
15
15
 
16
16
  has_many :items, inverse_of: :parent, class_name: klass.to_s,
17
- dependent: :destroy, autosave: true, order: :created_at.asc
17
+ dependent: :destroy, autosave: true, order: :_id.asc
18
18
  belongs_to :parent, inverse_of: :items, class_name: klass.to_s
19
19
 
20
+ # def destroy
21
+ # self.items.each { |item| item.destroy! }
22
+ # super
23
+ # end
24
+ set_callback(:destroy, :before) do |document|
25
+ document.items.each { |item| item.destroy! }
26
+ end
27
+
20
28
  def klass.run_class(run_klass)
21
29
  belongs_to :run, inverse_of: :items, class_name: run_klass.to_s
22
30
  end
23
31
 
24
-
25
32
  end
26
33
  end
27
34
 
28
- def parent
35
+ def get_parent
29
36
  self[:parent] || self[:run]
30
37
  end
31
38
 
32
39
  def get_run
33
- p = self[:parent]
34
- p ? p.get_run : self[:run]
40
+ self[:run] || self[:parent].get_run
35
41
  end
36
42
 
37
43
  def get_root
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
2
  require 'libis-workflow'
3
- require 'libis/workflow/mongoid/base'
4
3
 
5
4
  module Libis
6
5
  module Workflow
@@ -10,14 +9,32 @@ module Libis
10
9
 
11
10
  def self.included(klass)
12
11
  klass.class_eval do
13
- include Libis::Workflow::WorkItem
12
+ include ::Libis::Workflow::Base::WorkItem
14
13
  include Libis::Workflow::Mongoid::Base
15
14
 
16
15
  field :options, type: Hash, default: -> { Hash.new }
17
16
  field :properties, type: Hash, default: -> { Hash.new }
18
17
 
19
- field :log_history, type: Array, default: -> { Array.new }
20
- field :status_log, type: Array, default: -> { Array.new }
18
+ has_many :logs, as: :logger, class_name: 'Libis::Workflow::Mongoid::LogEntry',
19
+ dependent: :destroy, autosave: true, order: :_id.asc do
20
+ def log_history
21
+ where(:status.exists => false)
22
+ end
23
+
24
+ def status_log
25
+ where(:status.exists => true)
26
+ end
27
+ end
28
+
29
+ # def destroy
30
+ # # noinspection RubyResolve
31
+ # self.logs.each { |log| log.destroy }
32
+ # end
33
+
34
+ set_callback(:destroy, :before) do |document|
35
+ # noinspection RubyResolve
36
+ document.logs.each { |log| log.destroy! }
37
+ end
21
38
 
22
39
  field :summary, type: Hash, default: -> { Hash.new }
23
40
  end
@@ -37,6 +54,35 @@ module Libis
37
54
 
38
55
  alias :<< :add_item
39
56
 
57
+ def log_history
58
+ # noinspection RubyResolve
59
+ self.logs.log_history.all || []
60
+ end
61
+
62
+ def status_log
63
+ # noinspection RubyResolve
64
+ self.logs.status_log.all || []
65
+ end
66
+
67
+ protected
68
+
69
+ def add_log_entry(msg)
70
+ # noinspection RubyResolve
71
+ self.logs.build(msg)
72
+ end
73
+
74
+ def add_status_log(message, tasklist = nil)
75
+ # noinspection RubyResolve
76
+ self.logs.build(
77
+ task: (tasklist.join('/') rescue nil),
78
+ status: message
79
+ )
80
+ end
81
+
82
+ def status_label(status_entry)
83
+ "#{status_entry[:task].split('/').last rescue nil}#{status_entry[:status] rescue nil}"
84
+ end
85
+
40
86
  end
41
87
 
42
88
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'libis/workflow/base/workflow'
4
4
  require 'libis/workflow/mongoid/base'
5
+ require 'libis/tools/config_file'
5
6
 
6
7
  module Libis
7
8
  module Workflow
@@ -27,6 +28,15 @@ module Libis
27
28
  dependent: :destroy, autosave: true, order: :created_at.asc
28
29
  end
29
30
 
31
+ def klass.load(file_or_hash)
32
+ config = Libis::Tools::ConfigFile.new
33
+ config << file_or_hash
34
+ return nil if config.empty?
35
+ workflow = self.new
36
+ workflow.configure(config.to_h)
37
+ workflow
38
+ end
39
+
30
40
  def create_run_object
31
41
  # noinspection RubyResolve
32
42
  self.workflow_runs.build
@@ -8,12 +8,14 @@ module Libis
8
8
  module Workflow
9
9
  module Mongoid
10
10
 
11
- autoload :Config, 'libis/workflow/mongoid/config'
12
11
  autoload :Base, 'libis/workflow/mongoid/base'
13
- autoload :Workflow, 'libis/workflow/mongoid/workflow'
14
- autoload :WorkItem, 'libis/workflow/mongoid/work_item'
12
+ autoload :Config, 'libis/workflow/mongoid/config'
13
+ autoload :LogEntry, 'libis/workflow/mongoid/log_entry'
15
14
  autoload :Run, 'libis/workflow/mongoid/run'
15
+ autoload :WorkItem, 'libis/workflow/mongoid/work_item'
16
+ autoload :WorkItemBase, 'libis/workflow/mongoid/work_item_base'
16
17
  autoload :Worker, 'libis/workflow/mongoid/worker'
18
+ autoload :Workflow, 'libis/workflow/mongoid/workflow'
17
19
 
18
20
  def self.configure
19
21
  yield ::Libis::Workflow::Mongoid::Config.instance
@@ -5,9 +5,6 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  require 'libis/workflow/mongoid/version'
7
7
 
8
- mv_env = ENV['MONGOID_VERSION'] || '4.0'
9
- mongoid_version = mv_env == 'master' ? '{github: "mongoid/mongoid"}' : "~> #{mv_env}"
10
-
11
8
  Gem::Specification.new do |gem|
12
9
  gem.name = 'libis-workflow-mongoid'
13
10
  gem.version = ::Libis::Workflow::Mongoid::VERSION
@@ -28,13 +25,9 @@ Gem::Specification.new do |gem|
28
25
  gem.require_paths = ['lib']
29
26
 
30
27
  gem.add_runtime_dependency 'libis-workflow', '~> 2.0.beta'
31
- gem.add_runtime_dependency 'mongoid', mongoid_version
28
+ gem.add_runtime_dependency 'mongoid', '~> 5.0'
32
29
  gem.add_runtime_dependency 'mongoid-indifferent-access'
33
-
34
30
  gem.add_runtime_dependency 'sidekiq'
35
- if mv_env =~ /^3\./
36
- gem.add_runtime_dependency 'kiqstand'
37
- end
38
31
 
39
32
  gem.add_development_dependency 'bundler', '~> 1.6'
40
33
  gem.add_development_dependency 'rake'
data/mongoid.yml CHANGED
@@ -1,19 +1,127 @@
1
1
  # Mongoid Configuration for Travis CI
2
2
  # ===================================
3
3
 
4
- default:
5
-
6
4
  test:
7
- options:
8
- include_type_for_serialization: true
9
- include_root_in_json: false
10
- preload_models: false
11
- raise_not_found_error: false
12
- scope_overwrite_exception: true
13
- use_activesupport_time_zone: true
14
- use_utc: false
15
- sessions:
5
+ # Configure available database clients. (required)
6
+ clients:
7
+ # Defines the default client. (required)
16
8
  default:
9
+ # Defines the name of the default database that Mongoid can connect to.
10
+ # (required).
17
11
  database: workflow_test
12
+ # Provides the hosts the default client can connect to. Must be an array
13
+ # of host:port pairs. (required)
18
14
  hosts:
19
15
  - localhost:27017
16
+ options:
17
+ # Change the default write concern. (default = { w: 1 })
18
+ #write:
19
+ # w: 1
20
+
21
+ # Change the default read preference. Valid options for mode are: :secondary,
22
+ # :secondary_preferred, :primary, :primary_preferred, :nearest
23
+ # (default: primary)
24
+ #read:
25
+ # mode: :secondary_preferred
26
+
27
+ # The name of the user for authentication.
28
+ #user: 'user'
29
+
30
+ # The password of the user for authentication.
31
+ #password: 'password'
32
+
33
+ # The user's database roles.
34
+ #roles:
35
+ # - 'dbOwner'
36
+
37
+ # Change the default authentication mechanism. Valid options are: :scram,
38
+ # :mongodb_cr, :mongodb_x509, and :plain. (default on 3.0 is :scram, default
39
+ # on 2.4 and 2.6 is :plain)
40
+ #auth_mech: :scram
41
+
42
+ # The database or source to authenticate the user against. (default: admin)
43
+ #auth_source: admin
44
+
45
+ # Force a the driver cluster to behave in a certain manner instead of auto-
46
+ # discovering. Can be one of: :direct, :replica_set, :sharded. Set to :direct
47
+ # when connecting to hidden members of a replica set.
48
+ #connect: :direct
49
+
50
+ # Changes the default time in seconds the server monitors refresh their status
51
+ # via ismaster commands. (default: 10)
52
+ #heartbeat_frequency: 10
53
+
54
+ # The time in seconds for selecting servers for a near read preference. (default: 5)
55
+ #local_threshold: 5
56
+
57
+ # The timeout in seconds for selecting a server for an operation. (default: 30)
58
+ #server_selection_timeout: 30
59
+
60
+ # The maximum number of connections in the connection pool. (default: 5)
61
+ #max_pool_size: 5
62
+
63
+ # The minimum number of connections in the connection pool. (default: 1)
64
+ #min_pool_size: 1
65
+
66
+ # The time to wait, in seconds, in the connection pool for a connection
67
+ # to be checked in before timing out. (default: 5)
68
+ #wait_queue_timeout: 5
69
+
70
+ # The time to wait to establish a connection before timing out, in seconds.
71
+ # (default: 5)
72
+ #connect_timeout: 5
73
+
74
+ # The timeout to wait to execute operations on a socket before raising an error.
75
+ # (default: 5)
76
+ #socket_timeout: 5
77
+
78
+ # The name of the replica set to connect to. Servers provided as seeds that do
79
+ # not belong to this replica set will be ignored.
80
+ #replica_set: my_replica_set
81
+
82
+ # Whether to connect to the servers via ssl. (default: false)
83
+ #ssl: true
84
+
85
+ # The certificate file used to identify the connection against MongoDB.
86
+ #ssl_cert: /path/to/my.cert
87
+
88
+ # The private keyfile used to identify the connection against MongoDB.
89
+ # Note that even if the key is stored in the same file as the certificate,
90
+ # both need to be explicitly specified.
91
+ #ssl_key: /path/to/my.key
92
+
93
+ # A passphrase for the private key.
94
+ #ssl_key_pass_phrase: password
95
+
96
+ # Whether or not to do peer certification validation. (default: false)
97
+ #ssl_verify: true
98
+
99
+ # The file containing a set of concatenated certification authority certifications
100
+ # used to validate certs passed from the other end of the connection.
101
+ #ssl_ca_cert: /path/to/ca.cert
102
+
103
+ # Configure Mongoid specific options. (optional)
104
+ options:
105
+ # Includes the root model name in json serialization. (default: false)
106
+ #include_root_in_json: false
107
+
108
+ # Include the _type field in serialization. (default: false)
109
+ include_type_for_serialization: true
110
+
111
+ # Preload all models in development, needed when models use
112
+ # inheritance. (default: false)
113
+ #preload_models: false
114
+
115
+ # Raise an error when performing a #find and the document is not found.
116
+ # (default: true)
117
+ raise_not_found_error: false
118
+
119
+ # Raise an error when defining a scope with the same name as an
120
+ # existing method. (default: false)
121
+ scope_overwrite_exception: true
122
+
123
+ # Use Active Support's time zone in conversions. (default: true)
124
+ #use_activesupport_time_zone: true
125
+
126
+ # Ensure all times are UTC in the app side. (default: false)
127
+ #use_utc: false
@@ -1,8 +1,9 @@
1
1
  # encoding: utf-8
2
+ require 'libis/workflow'
2
3
  require_relative 'test_item'
3
4
 
4
5
  class TestDirItem < TestItem
5
- include ::Libis::Workflow::DirItem
6
+ include ::Libis::Workflow::Base::DirItem
6
7
 
7
8
  def name=(dir)
8
9
  raise RuntimeError, "'#{dir}' is not a directory" unless File.directory? dir
@@ -1,10 +1,11 @@
1
1
  # encoding: utf-8
2
2
  require 'libis-tools'
3
+ require 'libis-workflow'
3
4
 
4
5
  require_relative 'test_item'
5
6
 
6
7
  class TestFileItem < TestItem
7
- include ::Libis::Workflow::FileItem
8
+ include ::Libis::Workflow::Base::FileItem
8
9
 
9
10
  def filename=(file)
10
11
  raise RuntimeError, "'#{file}' is not a file" unless File.file? file
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require 'backports/rails/string'
3
-
4
- require 'libis/workflow/workitems'
3
+ require 'libis-workflow'
5
4
 
6
5
  class CamelizeName < ::Libis::Workflow::Task
7
6
 
@@ -2,7 +2,7 @@
2
2
  require 'libis/tools/checksum'
3
3
 
4
4
  require 'libis/exceptions'
5
- require 'libis/workflow/workitems'
5
+ require 'libis-workflow'
6
6
 
7
7
  class ChecksumTester < ::Libis::Workflow::Task
8
8
 
@@ -13,11 +13,10 @@ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
13
13
 
14
14
  describe 'TestWorkflow' do
15
15
 
16
- let(:dirname) { File.absolute_path(File.join(File.dirname(__FILE__), 'items')) }
16
+ before(:context) do
17
+ @dirname = File.absolute_path(File.join(File.dirname(__FILE__), 'items'))
18
+ @logoutput = StringIO.new
17
19
 
18
- let(:logoutput) { StringIO.new }
19
-
20
- let(:workflow) {
21
20
  # noinspection RubyResolve
22
21
  ::Libis::Workflow::Mongoid.configure do |cfg|
23
22
  cfg.itemdir = File.join(File.dirname(__FILE__), 'items')
@@ -34,10 +33,8 @@ describe 'TestWorkflow' do
34
33
  TestFileItem.create_indexes
35
34
  TestDirItem.create_indexes
36
35
 
37
- TestWorkflow.each { |wf| wf.destroy }
38
-
39
- workflow = TestWorkflow.new
40
- workflow.configure(
36
+ @workflow = TestWorkflow.find_or_initialize_by(name: 'TestWorkflow')
37
+ @workflow.configure(
41
38
  name: 'TestWorkflow',
42
39
  description: 'Workflow for testing',
43
40
  tasks: [
@@ -56,14 +53,17 @@ describe 'TestWorkflow' do
56
53
  checksum_type: {default: 'SHA1', propagate_to: 'ProcessFiles/ChecksumTester'}
57
54
  }
58
55
  )
59
- workflow.save
60
- workflow
61
- }
56
+ # noinspection RubyResolve
57
+ @workflow.workflow_runs.each { |run| run.destroy! }
58
+ @workflow.save
59
+ @run = @workflow.run(dirname: dirname, checksum_type: 'SHA256')
60
+
61
+ end
62
62
 
63
- let(:run) {
64
- # noinspection RubyStringKeysInHashInspection
65
- workflow.run(dirname: dirname, checksum_type: 'SHA256')
66
- }
63
+ def dirname; @dirname; end
64
+ def logoutput; @logoutput; end
65
+ def workflow; @workflow; end
66
+ def run; @run; end
67
67
 
68
68
  it 'should contain three tasks' do
69
69
 
@@ -88,70 +88,37 @@ describe 'TestWorkflow' do
88
88
 
89
89
  it 'should return expected debug output' do
90
90
 
91
- expect(run.summary['DEBUG']).to eq 57
92
- expect(run.log_history.count).to eq 8
91
+ expect(run.summary[:DEBUG]).to eq 21
92
+ expect(run.log_history.count).to eq 4
93
93
  expect(run.status_log.count).to eq 6
94
- expect(run.items.first.log_history.count).to eq 25
95
- expect(run.items.first.status_log.count).to eq 8
94
+ item = run.items.first
95
+ expect(item.log_history.count).to eq 17
96
+ expect(item.status_log.count).to eq 8
97
+ expect(item.summary[:DEBUG]).to eq 17
98
+
96
99
 
97
100
  sample_out = <<STR
98
- DEBUG -- CollectFiles - TestRun : Started
99
101
  DEBUG -- CollectFiles - TestRun : Processing subitem (1/1): items
100
- DEBUG -- CollectFiles - items : Started
101
102
  DEBUG -- CollectFiles - items : Processing subitem (1/4): test_dir_item.rb
102
- DEBUG -- CollectFiles - items/test_dir_item.rb : Started
103
- DEBUG -- CollectFiles - items/test_dir_item.rb : Completed
104
103
  DEBUG -- CollectFiles - items : Processing subitem (2/4): test_file_item.rb
105
- DEBUG -- CollectFiles - items/test_file_item.rb : Started
106
- DEBUG -- CollectFiles - items/test_file_item.rb : Completed
107
104
  DEBUG -- CollectFiles - items : Processing subitem (3/4): test_item.rb
108
- DEBUG -- CollectFiles - items/test_item.rb : Started
109
- DEBUG -- CollectFiles - items/test_item.rb : Completed
110
105
  DEBUG -- CollectFiles - items : Processing subitem (4/4): test_run.rb
111
- DEBUG -- CollectFiles - items/test_run.rb : Started
112
- DEBUG -- CollectFiles - items/test_run.rb : Completed
113
106
  DEBUG -- CollectFiles - items : 4 of 4 subitems passed
114
- DEBUG -- CollectFiles - items : Completed
115
107
  DEBUG -- CollectFiles - TestRun : 1 of 1 subitems passed
116
- DEBUG -- CollectFiles - TestRun : Completed
117
- DEBUG -- ProcessFiles - TestRun : Started
118
108
  DEBUG -- ProcessFiles - TestRun : Processing subitem (1/1): items
119
- DEBUG -- ProcessFiles - items : Started
120
109
  DEBUG -- ProcessFiles - items : Running subtask (1/2): ChecksumTester
121
- DEBUG -- ProcessFiles/ChecksumTester - items : Started
122
110
  DEBUG -- ProcessFiles/ChecksumTester - items : Processing subitem (1/4): test_dir_item.rb
123
- DEBUG -- ProcessFiles/ChecksumTester - items/test_dir_item.rb : Started
124
- DEBUG -- ProcessFiles/ChecksumTester - items/test_dir_item.rb : Completed
125
111
  DEBUG -- ProcessFiles/ChecksumTester - items : Processing subitem (2/4): test_file_item.rb
126
- DEBUG -- ProcessFiles/ChecksumTester - items/test_file_item.rb : Started
127
- DEBUG -- ProcessFiles/ChecksumTester - items/test_file_item.rb : Completed
128
112
  DEBUG -- ProcessFiles/ChecksumTester - items : Processing subitem (3/4): test_item.rb
129
- DEBUG -- ProcessFiles/ChecksumTester - items/test_item.rb : Started
130
- DEBUG -- ProcessFiles/ChecksumTester - items/test_item.rb : Completed
131
113
  DEBUG -- ProcessFiles/ChecksumTester - items : Processing subitem (4/4): test_run.rb
132
- DEBUG -- ProcessFiles/ChecksumTester - items/test_run.rb : Started
133
- DEBUG -- ProcessFiles/ChecksumTester - items/test_run.rb : Completed
134
114
  DEBUG -- ProcessFiles/ChecksumTester - items : 4 of 4 subitems passed
135
- DEBUG -- ProcessFiles/ChecksumTester - items : Completed
136
115
  DEBUG -- ProcessFiles - items : Running subtask (2/2): CamelizeName
137
- DEBUG -- ProcessFiles/CamelizeName - items : Started
138
116
  DEBUG -- ProcessFiles/CamelizeName - Items : Processing subitem (1/4): test_dir_item.rb
139
- DEBUG -- ProcessFiles/CamelizeName - Items/test_dir_item.rb : Started
140
- DEBUG -- ProcessFiles/CamelizeName - Items/TestDirItem.rb : Completed
141
117
  DEBUG -- ProcessFiles/CamelizeName - Items : Processing subitem (2/4): test_file_item.rb
142
- DEBUG -- ProcessFiles/CamelizeName - Items/test_file_item.rb : Started
143
- DEBUG -- ProcessFiles/CamelizeName - Items/TestFileItem.rb : Completed
144
118
  DEBUG -- ProcessFiles/CamelizeName - Items : Processing subitem (3/4): test_item.rb
145
- DEBUG -- ProcessFiles/CamelizeName - Items/test_item.rb : Started
146
- DEBUG -- ProcessFiles/CamelizeName - Items/TestItem.rb : Completed
147
119
  DEBUG -- ProcessFiles/CamelizeName - Items : Processing subitem (4/4): test_run.rb
148
- DEBUG -- ProcessFiles/CamelizeName - Items/test_run.rb : Started
149
- DEBUG -- ProcessFiles/CamelizeName - Items/TestRun.rb : Completed
150
120
  DEBUG -- ProcessFiles/CamelizeName - Items : 4 of 4 subitems passed
151
- DEBUG -- ProcessFiles/CamelizeName - Items : Completed
152
- DEBUG -- ProcessFiles - Items : Completed
153
121
  DEBUG -- ProcessFiles - TestRun : 1 of 1 subitems passed
154
- DEBUG -- ProcessFiles - TestRun : Completed
155
122
  STR
156
123
  sample_out = sample_out.lines.to_a
157
124
  output = logoutput.string.lines
@@ -186,32 +153,20 @@ STR
186
153
 
187
154
  # noinspection RubyResolve
188
155
  it 'find run' do
189
- run
190
156
  wf = TestWorkflow.first
191
- expect(wf.workflow_runs.count).to be > 0
192
- wf_run = wf.workflow_runs.first
193
- expect(wf_run.is_a? TestRun).to eq true
194
- expect(wf_run.nil?).to eq false
195
- expect(wf_run.options[:dirname]).to eq dirname
196
- expect(wf_run.properties[:ingest_failed]).to eq false
197
- expect(wf_run.log_history.count).to eq 8
198
- expect(wf_run.status_log.count).to eq 6
199
- expect(wf_run.summary[:DEBUG]).to eq 57
157
+ expect(wf).to eq workflow
158
+ expect(workflow.workflow_runs.all.count).to eq 1
159
+ wf_run = workflow.workflow_runs.all.first
160
+ expect(wf_run).to eq run
200
161
  end
201
162
 
202
163
  # noinspection RubyResolve
203
164
  it 'find first item' do
204
- run
205
- wf = TestWorkflow.first
206
- expect(wf.workflow_runs.first.items.count).to be > 0
207
- item = wf.workflow_runs.first.items.first
165
+ item = run.items.first
208
166
  expect(item.nil?).to eq false
209
167
  expect(item.is_a? TestDirItem).to eq true
210
168
  expect(item.properties[:name]).to eq 'Items'
211
169
  expect(item.properties[:ingest_failed]).to eq false
212
- expect(item.log_history.count).to eq 25
213
- expect(item.status_log.count).to eq 8
214
- expect(item.summary[:DEBUG]).to eq 49
215
170
  end
216
171
 
217
172
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libis-workflow-mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.beta.8
4
+ version: 2.0.beta.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kris Dekeyser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-22 00:00:00.000000000 Z
11
+ date: 2015-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: libis-workflow
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '4.0'
33
+ version: '5.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '4.0'
40
+ version: '5.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mongoid-indifferent-access
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -141,6 +141,7 @@ files:
141
141
  - lib/libis/workflow/mongoid.rb
142
142
  - lib/libis/workflow/mongoid/base.rb
143
143
  - lib/libis/workflow/mongoid/config.rb
144
+ - lib/libis/workflow/mongoid/log_entry.rb
144
145
  - lib/libis/workflow/mongoid/run.rb
145
146
  - lib/libis/workflow/mongoid/sequence.rb
146
147
  - lib/libis/workflow/mongoid/version.rb
@@ -183,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
184
  version: 1.3.1
184
185
  requirements: []
185
186
  rubyforge_project:
186
- rubygems_version: 2.4.8
187
+ rubygems_version: 2.2.2
187
188
  signing_key:
188
189
  specification_version: 4
189
190
  summary: Mongoid persistence for the LIBIS Workflow framework.