razorrisk-core-diagnostics 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +89 -0
- data/lib/razor_risk/core/diagnostics/exceptions/rrcs_base_exception.rb +48 -0
- data/lib/razor_risk/core/diagnostics/exceptions.rb +3 -0
- data/lib/razor_risk/core/diagnostics/logger/logger.rb +150 -0
- data/lib/razor_risk/core/diagnostics/logger.rb +3 -0
- data/lib/razor_risk/core/diagnostics/logic_errors/rrcs_logic_error.rb +52 -0
- data/lib/razor_risk/core/diagnostics/logic_errors.rb +3 -0
- data/lib/razor_risk/core/diagnostics/throwable.rb +41 -0
- data/lib/razor_risk/core/diagnostics/version.rb +38 -0
- data/test/unit/core/diagnostics/exceptions/tc_rrcs_base_exception.rb +86 -0
- data/test/unit/core/diagnostics/logic_errors/tc_rrcs_logic_error.rb +68 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8cb8983ea3ea7fb82efa8fc51ca648ae188eacec
|
4
|
+
data.tar.gz: 89a05dfec7af4a985f6dd9317c391bdcf415cede
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 438b3586b47dbdc4b6009a7513994d3e0822eb297d657ebbcf34570dec9074515938127e91c02540a7a1c1c4b233f01fc84c66cec3afbd5d276c770f5dc92c94
|
7
|
+
data.tar.gz: a6adf56e798df7e7b985406f80455d85553cdf60204e061cb0a9bdf0d3a7e242ae841d958398ae467306be6b64f176f16ef5a9dfa6acbf5bed9519cb03999001
|
data/Rakefile
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# ######################################################################## #
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019 Razor Risk Technologies Pty Limited. All rights reserved.
|
6
|
+
#
|
7
|
+
# ######################################################################## #
|
8
|
+
|
9
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'lib')
|
10
|
+
|
11
|
+
# ##########################################################
|
12
|
+
# bundler
|
13
|
+
|
14
|
+
require 'rubygems'
|
15
|
+
require 'bundler/setup'
|
16
|
+
|
17
|
+
# ######################################################################## #
|
18
|
+
# requires
|
19
|
+
|
20
|
+
require 'razor_risk/razor/control/rake_helpers/diagnostic_tasks'
|
21
|
+
require 'razor_risk/razor/control/rake_helpers/gem_tasks'
|
22
|
+
require 'razor_risk/razor/control/rake_helpers/task_helpers'
|
23
|
+
|
24
|
+
require 'rake'
|
25
|
+
require 'rake/clean'
|
26
|
+
|
27
|
+
# ##########################################################
|
28
|
+
# includes
|
29
|
+
|
30
|
+
include ::RazorRisk::Razor::Control # rubocop:todo Style/MixinUsage
|
31
|
+
include ::Pantheios # rubocop:todo Style/MixinUsage
|
32
|
+
|
33
|
+
# ##########################################################
|
34
|
+
# Constants
|
35
|
+
|
36
|
+
Spec = ::Gem::Specification.load(Dir['*.gemspec'].first)
|
37
|
+
LogDir = 'log' # rubocop:todo Naming/ConstantName
|
38
|
+
# rubocop:todo Naming/ConstantName
|
39
|
+
LogThresholds = %i[informational informational].freeze
|
40
|
+
# rubocop:enable Naming/ConstantName
|
41
|
+
|
42
|
+
# ##########################################################
|
43
|
+
# clean/clobber
|
44
|
+
|
45
|
+
Dir[
|
46
|
+
'log',
|
47
|
+
'doc',
|
48
|
+
].each { |f| CLEAN << f }
|
49
|
+
Dir[
|
50
|
+
'.bundle',
|
51
|
+
'vendor',
|
52
|
+
'GEM_HOME',
|
53
|
+
'*.gem',
|
54
|
+
].each { |f| CLOBBER << f }
|
55
|
+
|
56
|
+
# ##########################################################
|
57
|
+
# Tasks
|
58
|
+
|
59
|
+
desc 'Run tests'
|
60
|
+
task test: [:'gem:unit_test']
|
61
|
+
|
62
|
+
desc 'Build gem'
|
63
|
+
task :build_gem, [:path] => :'gem:build'
|
64
|
+
|
65
|
+
desc 'Builds the Razor EntityConnector Gem'
|
66
|
+
task :build, [:path] => [:build_gem]
|
67
|
+
|
68
|
+
desc 'Push the gem to the gem server.'
|
69
|
+
task deploy: :'gem:push'
|
70
|
+
|
71
|
+
# ##########################################################
|
72
|
+
# Hooks
|
73
|
+
|
74
|
+
task :default do
|
75
|
+
puts 'Run \'bundler exec rake --tasks\' to see available tasks'
|
76
|
+
end
|
77
|
+
|
78
|
+
task :first do
|
79
|
+
::Rake::Task[:'diagnostics:init'].execute(
|
80
|
+
name: Spec.name,
|
81
|
+
version: Spec.version.to_s,
|
82
|
+
directory: LogDir,
|
83
|
+
thresholds: LogThresholds
|
84
|
+
)
|
85
|
+
end
|
86
|
+
|
87
|
+
RakeHelpers::TaskHelpers.add_hooks
|
88
|
+
|
89
|
+
# ############################## end of file ############################# #
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# ######################################################################## #
|
4
|
+
# File: lib/razor_risk/core/diagnostics/exceptions/rrcs_basic_exception.rb
|
5
|
+
#
|
6
|
+
# Purpose: Definition of the
|
7
|
+
# ::RazorRisk::Core::Diagnostics::Exceptions::RRCSBaseException
|
8
|
+
# class
|
9
|
+
#
|
10
|
+
# Created: 10th December 2017
|
11
|
+
# Updated: 28th January 2018
|
12
|
+
#
|
13
|
+
# Author: Matthew Wilson
|
14
|
+
#
|
15
|
+
# Copyright (c) 2017-2018, Razor Risk Technologies Pty Ltd
|
16
|
+
# All rights reserved.
|
17
|
+
#
|
18
|
+
# ######################################################################## #
|
19
|
+
|
20
|
+
require 'razor_risk/core/diagnostics/throwable'
|
21
|
+
require 'xqsr3/diagnostics/exceptions/with_cause'
|
22
|
+
|
23
|
+
module RazorRisk
|
24
|
+
module Core
|
25
|
+
module Diagnostics
|
26
|
+
module Exceptions
|
27
|
+
# Root exception for all Razor Risk exceptions
|
28
|
+
class RRCSBaseException < StandardError
|
29
|
+
include Throwable
|
30
|
+
|
31
|
+
include ::Xqsr3::Diagnostics::Exceptions::WithCause
|
32
|
+
|
33
|
+
def self.new(*args)
|
34
|
+
if self == RRCSBaseException
|
35
|
+
raise NoMethodError, "private method `new' called for #{self}:Class"
|
36
|
+
end
|
37
|
+
|
38
|
+
super
|
39
|
+
end
|
40
|
+
# rubocop:todo Style/CommentedKeyword
|
41
|
+
end # class RRCSBaseException
|
42
|
+
# rubocop:enable Style/CommentedKeyword
|
43
|
+
end # module Exceptions # rubocop:todo Style/CommentedKeyword
|
44
|
+
end # module Diagnostics # rubocop:todo Style/CommentedKeyword
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# ############################## end of file ############################# #
|
@@ -0,0 +1,150 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# ######################################################################## #
|
5
|
+
# File: razor_risk/core/diagnostics/logger.rb
|
6
|
+
#
|
7
|
+
# Purpose: Overriding pantheios.api module
|
8
|
+
#
|
9
|
+
# Author: Razor Risk
|
10
|
+
#
|
11
|
+
# Copyright (c) 2017-2018, Razor Risk Technologies Pty Ltd
|
12
|
+
# All rights reserved.
|
13
|
+
#
|
14
|
+
# ######################################################################## #
|
15
|
+
|
16
|
+
# requires
|
17
|
+
|
18
|
+
require 'pantheios'
|
19
|
+
|
20
|
+
# Module Definitions
|
21
|
+
|
22
|
+
module RazorRisk
|
23
|
+
module Core
|
24
|
+
module Diagnostics
|
25
|
+
module Logger
|
26
|
+
# Logs an arbitrary set of parameters at the given severity level
|
27
|
+
def log(severity, *args, &block)
|
28
|
+
return nil unless severity_logged? severity
|
29
|
+
|
30
|
+
log_or_trace_with_block_ 1, severity, args, &block
|
31
|
+
end
|
32
|
+
|
33
|
+
# Logs an array of parameters at the given severity level
|
34
|
+
def log_v(severity, argv, &block)
|
35
|
+
return nil unless severity_logged? severity
|
36
|
+
|
37
|
+
log_or_trace_with_block_ 1, severity, argv, &block
|
38
|
+
end
|
39
|
+
|
40
|
+
# Logs an arbitrary set of parameters at the Trace (:trace) level
|
41
|
+
def trace(*args, &block)
|
42
|
+
return nil unless tracing?
|
43
|
+
|
44
|
+
trace_with_block_ 1, args, &block
|
45
|
+
end
|
46
|
+
|
47
|
+
# Logs an array of parameters at the Trace (:trace) level
|
48
|
+
def trace_v(argv, &block)
|
49
|
+
return nil unless tracing?
|
50
|
+
|
51
|
+
trace_with_block_ 1, argv, &block
|
52
|
+
end
|
53
|
+
|
54
|
+
# Obtains a string-form of the timestamp
|
55
|
+
#
|
56
|
+
# Unless overridden, returns the value provided by
|
57
|
+
# +::Pantheios::Core::timestamp+
|
58
|
+
def timestamp(t)
|
59
|
+
::Pantheios::Core.timestamp t, '%Y-%m-%dT%H:%M:%S.%6N'
|
60
|
+
end
|
61
|
+
|
62
|
+
# Obtains the process id
|
63
|
+
#
|
64
|
+
# Unless overridden, returns the value provided by
|
65
|
+
# +::Pantheios::Core::process_id+
|
66
|
+
def process_id
|
67
|
+
::Pantheios::Core.process_id
|
68
|
+
end
|
69
|
+
|
70
|
+
# Obtains the program name
|
71
|
+
#
|
72
|
+
# Unless overridden, returns the value provided by
|
73
|
+
# +::Pantheios::Core::process_name+
|
74
|
+
def process_name
|
75
|
+
::Pantheios::Core.process_name
|
76
|
+
end
|
77
|
+
|
78
|
+
# Obtains the string corresponding to the severity
|
79
|
+
#
|
80
|
+
# Unless overridden, returns the value provided by
|
81
|
+
# +::Pantheios::Core::severity_string+
|
82
|
+
def severity_string(severity)
|
83
|
+
sev = ::Pantheios::Core.severity_string severity
|
84
|
+
if %w[Alert Warning].include? sev
|
85
|
+
'WARN'
|
86
|
+
elsif %w[Notice Informational].include? sev
|
87
|
+
'INFO'
|
88
|
+
elsif %w[Debug-0 Debug-1 Debug-2 Debug-3 Debug-4].include? sev
|
89
|
+
'DEBUG'
|
90
|
+
elsif sev == 'Critical'
|
91
|
+
'FATAL'
|
92
|
+
elsif sev == 'Failure'
|
93
|
+
'ERROR'
|
94
|
+
else
|
95
|
+
sev.upcase
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# Obtains the thread id
|
100
|
+
#
|
101
|
+
# Unless overridden, returns the value provided by
|
102
|
+
# +::Pantheios::Core::thread_id+
|
103
|
+
def thread_id
|
104
|
+
::Pantheios::Core.thread_id
|
105
|
+
end
|
106
|
+
|
107
|
+
def prefix_elements
|
108
|
+
%i[timestamp process_name process_id severity]
|
109
|
+
end
|
110
|
+
|
111
|
+
def prefix(t, severity)
|
112
|
+
prefix_elements.map do |el|
|
113
|
+
case el
|
114
|
+
when :timestamp
|
115
|
+
timestamp t
|
116
|
+
|
117
|
+
when :program_name, :process_name
|
118
|
+
process_name.upcase
|
119
|
+
|
120
|
+
when :process_id
|
121
|
+
'RWS'
|
122
|
+
|
123
|
+
when :severity
|
124
|
+
severity_string severity
|
125
|
+
else
|
126
|
+
s = ::Symbol === el ? ":#{el}" : el.to_s
|
127
|
+
warn "ignoring unrecognised prefix_element '#{s}'"
|
128
|
+
nil
|
129
|
+
end
|
130
|
+
end.join(' ')
|
131
|
+
end
|
132
|
+
|
133
|
+
private
|
134
|
+
|
135
|
+
# Private implementation methods not meant for override
|
136
|
+
def log_or_trace_with_block_(call_depth, severity, argv, &block)
|
137
|
+
if severity == :trace
|
138
|
+
return ::Pantheios::Core.trace_v_impl self, 1 + call_depth, nil, severity, argv, &block
|
139
|
+
end
|
140
|
+
|
141
|
+
::Pantheios::Core.log_v_impl self, severity, argv, &block
|
142
|
+
end
|
143
|
+
|
144
|
+
def trace_with_block_(call_depth, argv, &block)
|
145
|
+
::Pantheios::Core.trace_v_impl self, 1 + call_depth, nil, :trace, argv, &block
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# ######################################################################## #
|
4
|
+
# File: lib/razor_risk/core/diagnostics/logic_erors/rrcs_logic_error.rb
|
5
|
+
#
|
6
|
+
# Purpose: Definition of the
|
7
|
+
# ::RazorRisk::Core::Diagnostics::LogicErrors::RRCSLogiError
|
8
|
+
# class
|
9
|
+
#
|
10
|
+
# Created: 10th December 2017
|
11
|
+
# Updated: 28th January 2018
|
12
|
+
#
|
13
|
+
# Author: Matthew Wilson
|
14
|
+
#
|
15
|
+
# Copyright (c) 2017-2018, Razor Risk Technologies Pty Ltd
|
16
|
+
# All rights reserved.
|
17
|
+
#
|
18
|
+
# ######################################################################## #
|
19
|
+
|
20
|
+
require 'razor_risk/core/diagnostics/throwable'
|
21
|
+
require 'xqsr3/diagnostics/exceptions/with_cause'
|
22
|
+
|
23
|
+
module RazorRisk
|
24
|
+
module Core
|
25
|
+
module Diagnostics
|
26
|
+
module LogicErrors
|
27
|
+
# Root exception for all Razor Risk logic errors
|
28
|
+
class RRCSLogicError < RuntimeError
|
29
|
+
include Throwable
|
30
|
+
|
31
|
+
include ::Xqsr3::Diagnostics::Exceptions::WithCause
|
32
|
+
|
33
|
+
def faulted?
|
34
|
+
true
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.new(*args)
|
38
|
+
if self == RRCSLogicError
|
39
|
+
raise NoMethodError, "private method `new' called for #{self}:Class"
|
40
|
+
end
|
41
|
+
|
42
|
+
super
|
43
|
+
end
|
44
|
+
# rubocop:todo Style/CommentedKeyword
|
45
|
+
end # class RRCSLogicError
|
46
|
+
# rubocop:enable Style/CommentedKeyword
|
47
|
+
end # module LogicErrors # rubocop:todo Style/CommentedKeyword
|
48
|
+
end # module Diagnostics # rubocop:todo Style/CommentedKeyword
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# ############################## end of file ############################# #
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RazorRisk
|
4
|
+
module Core
|
5
|
+
module Diagnostics
|
6
|
+
# Inclusion module incorporated into all Razor Risk exceptions and logic
|
7
|
+
# errors, which provides all thrown types with the Exception Vocabulary
|
8
|
+
# espoused in the article "Exceptions : The Worst Form of 'Error' Handling
|
9
|
+
# Except For All The Others", Matthew Wilson, ACCU Overload Journal #98,
|
10
|
+
# August 2010, available at https://accu.org/index.php/journals/1681 and at
|
11
|
+
# http://synesis.com.au/publishing/quality-matters/exceptions-the-worst-form-of-error-handling-apart-from-all-the-others.html
|
12
|
+
#
|
13
|
+
module Throwable
|
14
|
+
# Indicates whether the instance is thrown as part of normative
|
15
|
+
# behaviour
|
16
|
+
def normative?
|
17
|
+
false
|
18
|
+
end
|
19
|
+
|
20
|
+
# Indicates whether the instance is thrown to indicate a recoverable
|
21
|
+
# failure
|
22
|
+
def recoverable?
|
23
|
+
false
|
24
|
+
end
|
25
|
+
|
26
|
+
# Indicates whether the instance is thrown to indicate a
|
27
|
+
# practically-unrecoverable failure
|
28
|
+
def practically_unrecoverable?
|
29
|
+
false
|
30
|
+
end
|
31
|
+
|
32
|
+
# Indicates whether the instance is thrown to indicate a faulted
|
33
|
+
# contition (i.e. a fault arising from a defect arising from a
|
34
|
+
# programming error)
|
35
|
+
def faulted?
|
36
|
+
false
|
37
|
+
end
|
38
|
+
end # module Throwable # rubocop:todo Style/CommentedKeyword
|
39
|
+
end # module Diagnostics # rubocop:todo Style/CommentedKeyword
|
40
|
+
end # module Core # rubocop:todo Style/CommentedKeyword
|
41
|
+
end # module RazorRisk # rubocop:todo Style/CommentedKeyword
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# ##########################################################################
|
4
|
+
#
|
5
|
+
# Version for RazorRisk.Ruby.Core.Diagnostics library
|
6
|
+
#
|
7
|
+
# Copyright (c) 2019 Razor Risk Technologies Pty Limited. All rights reserved.
|
8
|
+
#
|
9
|
+
# ##########################################################################
|
10
|
+
|
11
|
+
module RazorRisk
|
12
|
+
module Core
|
13
|
+
module Diagnostics # rubocop:todo Style/Documentation
|
14
|
+
# Current version of the RazorRisk::Core::Diagnostics library
|
15
|
+
VERSION = '0.2.0'
|
16
|
+
|
17
|
+
private # rubocop:todo Lint/UselessAccessModifier
|
18
|
+
|
19
|
+
VERSION_PARTS_ = VERSION.split(/[.]/).collect(&:to_i)
|
20
|
+
|
21
|
+
public # rubocop:todo Lint/UselessAccessModifier
|
22
|
+
|
23
|
+
# Major version of the RazorRisk::Core::Diagnostics library
|
24
|
+
VERSION_MAJOR = VERSION_PARTS_[0]
|
25
|
+
# Minor version of the RazorRisk::Core::Diagnostics library
|
26
|
+
VERSION_MINOR = VERSION_PARTS_[1]
|
27
|
+
# Patch version of the RazorRisk::Core::Diagnostics library
|
28
|
+
VERSION_PATCH = VERSION_PARTS_[2]
|
29
|
+
# Commit version of the RazorRisk::Core::Diagnostics library
|
30
|
+
VERSION_COMMIT = VERSION_PARTS_[3] || 0
|
31
|
+
|
32
|
+
# The description of the framework
|
33
|
+
DESCRIPTION = "Razor Risk's Core Services' Diagnostics library"
|
34
|
+
end # module Diagnostics # rubocop:todo Style/CommentedKeyword
|
35
|
+
end # module Core # rubocop:todo Style/CommentedKeyword
|
36
|
+
end # module RazorRisk # rubocop:todo Style/CommentedKeyword
|
37
|
+
|
38
|
+
# ############################## end of file ############################# #
|
@@ -0,0 +1,86 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# ##########################################################################
|
5
|
+
#
|
6
|
+
# Copyright (c) 2017 Razor Risk Technologies Pty Limited. All rights reserved.
|
7
|
+
#
|
8
|
+
# ##########################################################################
|
9
|
+
|
10
|
+
# ##########################################################
|
11
|
+
# load path
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *(['..'] * 4), 'lib')
|
14
|
+
|
15
|
+
# ##########################################################
|
16
|
+
# diagnostics
|
17
|
+
|
18
|
+
unless $DEBUG
|
19
|
+
|
20
|
+
require 'pantheios/globals'
|
21
|
+
require 'pantheios/services/null_log_service'
|
22
|
+
|
23
|
+
::Pantheios::Globals.INITIAL_SERVICE_CLASSES = [::Pantheios::Services::NullLogService]
|
24
|
+
end
|
25
|
+
|
26
|
+
# ##########################################################
|
27
|
+
# code coverage
|
28
|
+
|
29
|
+
require 'simplecov'
|
30
|
+
|
31
|
+
# ##########################################################
|
32
|
+
# requires
|
33
|
+
|
34
|
+
require 'razor_risk/core/diagnostics/exceptions'
|
35
|
+
|
36
|
+
require 'xqsr3/extensions/test/unit'
|
37
|
+
|
38
|
+
require 'test/unit'
|
39
|
+
|
40
|
+
# ##########################################################
|
41
|
+
# tests
|
42
|
+
|
43
|
+
# rubocop:todo Style/Documentation
|
44
|
+
# rubocop:todo Naming/ClassAndModuleCamelCase
|
45
|
+
class Test_RRCSBaseException < Test::Unit::TestCase
|
46
|
+
include ::RazorRisk::Core::Diagnostics::Exceptions
|
47
|
+
|
48
|
+
class TestException < RRCSBaseException
|
49
|
+
end
|
50
|
+
class TestExceptionWithParams < RRCSBaseException
|
51
|
+
def initialize(p0, p1) # rubocop:todo Naming/MethodParameterName
|
52
|
+
@attr0 = p0
|
53
|
+
@attr1 = p1
|
54
|
+
end
|
55
|
+
|
56
|
+
attr_reader :attr0
|
57
|
+
attr_reader :attr1
|
58
|
+
end
|
59
|
+
# rubocop:enable Style/Documentation
|
60
|
+
|
61
|
+
def test_type_exists_and_is_a_class
|
62
|
+
assert defined? RRCSBaseException
|
63
|
+
|
64
|
+
# rubocop:todo Style/CaseEquality
|
65
|
+
assert Class === RRCSBaseException
|
66
|
+
# rubocop:enable Style/CaseEquality
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_construct_is_not_valid
|
70
|
+
assert_raise(::NoMethodError) { RRCSBaseException.new }
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_construct_derived_class_is_valid
|
74
|
+
TestException.new
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_construct_derived_class_with_params
|
78
|
+
x = TestExceptionWithParams.new 'a0', 'a1'
|
79
|
+
|
80
|
+
assert_equal 'a0', x.attr0
|
81
|
+
assert_equal 'a1', x.attr1
|
82
|
+
end
|
83
|
+
end
|
84
|
+
# rubocop:enable Naming/ClassAndModuleCamelCase
|
85
|
+
|
86
|
+
# ############################## end of file ############################# #
|
@@ -0,0 +1,68 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# ##########################################################################
|
5
|
+
#
|
6
|
+
# Copyright (c) 2017 Razor Risk Technologies Pty Limited. All rights reserved.
|
7
|
+
#
|
8
|
+
# ##########################################################################
|
9
|
+
|
10
|
+
# ##########################################################
|
11
|
+
# load path
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *(['..'] * 4), 'lib')
|
14
|
+
|
15
|
+
# ##########################################################
|
16
|
+
# diagnostics
|
17
|
+
|
18
|
+
unless $DEBUG
|
19
|
+
|
20
|
+
require 'pantheios/globals'
|
21
|
+
require 'pantheios/services/null_log_service'
|
22
|
+
|
23
|
+
::Pantheios::Globals.INITIAL_SERVICE_CLASSES = [::Pantheios::Services::NullLogService]
|
24
|
+
end
|
25
|
+
|
26
|
+
# ##########################################################
|
27
|
+
# code coverage
|
28
|
+
|
29
|
+
require 'simplecov'
|
30
|
+
|
31
|
+
# ##########################################################
|
32
|
+
# requires
|
33
|
+
|
34
|
+
require 'razor_risk/core/diagnostics/logic_errors'
|
35
|
+
|
36
|
+
require 'xqsr3/extensions/test/unit'
|
37
|
+
|
38
|
+
require 'test/unit'
|
39
|
+
|
40
|
+
# ##########################################################
|
41
|
+
# tests
|
42
|
+
|
43
|
+
# rubocop:todo Style/Documentation
|
44
|
+
# rubocop:todo Naming/ClassAndModuleCamelCase
|
45
|
+
class Test_RRCSLogicError < Test::Unit::TestCase
|
46
|
+
include ::RazorRisk::Core::Diagnostics::LogicErrors
|
47
|
+
|
48
|
+
class TestError < RRCSLogicError
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_type_exists_and_is_a_class
|
52
|
+
assert defined? RRCSLogicError
|
53
|
+
|
54
|
+
assert Class === RRCSLogicError # rubocop:todo Style/CaseEquality
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_construct_is_not_valid
|
58
|
+
assert_raise(::NoMethodError) { RRCSLogicError.new }
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_construct_derived_class_is_valid
|
62
|
+
TestError.new
|
63
|
+
end
|
64
|
+
end
|
65
|
+
# rubocop:enable Naming/ClassAndModuleCamelCase
|
66
|
+
# rubocop:enable Style/Documentation
|
67
|
+
|
68
|
+
# ############################## end of file ############################# #
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: razorrisk-core-diagnostics
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Razor Risk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-08-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: razorrisk-core-baseutilities
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pantheios-ruby
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.20.2
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.20.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: xqsr3
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.30'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.30'
|
55
|
+
description: Razor Risk's Core Services' Diagnostics library
|
56
|
+
email: operations@razor-risk.com
|
57
|
+
executables: []
|
58
|
+
extensions: []
|
59
|
+
extra_rdoc_files: []
|
60
|
+
files:
|
61
|
+
- Rakefile
|
62
|
+
- lib/razor_risk/core/diagnostics/exceptions.rb
|
63
|
+
- lib/razor_risk/core/diagnostics/exceptions/rrcs_base_exception.rb
|
64
|
+
- lib/razor_risk/core/diagnostics/logger.rb
|
65
|
+
- lib/razor_risk/core/diagnostics/logger/logger.rb
|
66
|
+
- lib/razor_risk/core/diagnostics/logic_errors.rb
|
67
|
+
- lib/razor_risk/core/diagnostics/logic_errors/rrcs_logic_error.rb
|
68
|
+
- lib/razor_risk/core/diagnostics/throwable.rb
|
69
|
+
- lib/razor_risk/core/diagnostics/version.rb
|
70
|
+
- test/unit/core/diagnostics/exceptions/tc_rrcs_base_exception.rb
|
71
|
+
- test/unit/core/diagnostics/logic_errors/tc_rrcs_logic_error.rb
|
72
|
+
homepage: https://razor-risk.com/software
|
73
|
+
licenses: []
|
74
|
+
metadata: {}
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '2.0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 2.6.14
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: RazorRisk.Ruby.Core.Diagnostics
|
95
|
+
test_files: []
|