evt-messaging-fixtures 1.0.0.0 → 1.0.0.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dabbdd5e085b64d012cbaf5ace9a9f610b5788c980a3e17410a6e8caeebc192
|
4
|
+
data.tar.gz: a706e6e94fa33a35697f0bafeae2a2f2ae4a4c0f41551ea57cc2451281aa677d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79bc41a6bda26bde771dc9392bd5af989dcb1aa358bc565bc36f43c72ec4529536234faf17283eb972e3f639f2e90371cb2f483c2d63a2a50861b08946d92202
|
7
|
+
data.tar.gz: cd8759dd0cf39e8e8ad581f3dd94f6ebc5484cdec4ab226b0a558a497bb5f8afaf4e11df898a413c175fc65b8c2ccdd85612eb332aea61b899e671c55b3588ef
|
@@ -79,37 +79,3 @@ module Messaging
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
82
|
-
__END__
|
83
|
-
|
84
|
-
handle Withdraw do |withdraw|
|
85
|
-
account_id = withdraw.account_id
|
86
|
-
|
87
|
-
account, version = store.fetch(account_id, include: :version)
|
88
|
-
|
89
|
-
sequence = withdraw.metadata.global_position
|
90
|
-
|
91
|
-
if account.processed?(sequence)
|
92
|
-
logger.info(tag: :ignored) { "Command ignored (Command: #{withdraw.message_type}, Account ID: #{account_id}, Account Sequence: #{account.sequence}, Withdrawal Sequence: #{sequence})" }
|
93
|
-
return
|
94
|
-
end
|
95
|
-
|
96
|
-
time = clock.iso8601
|
97
|
-
|
98
|
-
stream_name = stream_name(account_id)
|
99
|
-
|
100
|
-
unless account.sufficient_funds?(withdraw.amount)
|
101
|
-
withdrawal_rejected = WithdrawalRejected.follow(withdraw)
|
102
|
-
withdrawal_rejected.time = time
|
103
|
-
withdrawal_rejected.sequence = sequence
|
104
|
-
|
105
|
-
write.(withdrawal_rejected, stream_name, expected_version: version)
|
106
|
-
|
107
|
-
return
|
108
|
-
end
|
109
|
-
|
110
|
-
withdrawn = Withdrawn.follow(withdraw)
|
111
|
-
withdrawn.processed_time = time
|
112
|
-
withdrawn.sequence = sequence
|
113
|
-
|
114
|
-
write.(withdrawn, stream_name, expected_version: version)
|
115
|
-
end
|
@@ -11,10 +11,10 @@ module Messaging
|
|
11
11
|
entity.sequence
|
12
12
|
end
|
13
13
|
|
14
|
-
initializer :handler, :input_message, :entity, :entity_version, :clock_time, :identifier_uuid, :
|
14
|
+
initializer :handler, :input_message, :entity, :entity_version, :clock_time, :identifier_uuid, :test_block
|
15
15
|
|
16
|
-
def self.build(handler, input_message, entity=nil, entity_version=nil, clock_time: nil, identifier_uuid: nil, &
|
17
|
-
instance = new(handler, input_message, entity, entity_version, clock_time, identifier_uuid,
|
16
|
+
def self.build(handler, input_message, entity=nil, entity_version=nil, clock_time: nil, identifier_uuid: nil, &test_block)
|
17
|
+
instance = new(handler, input_message, entity, entity_version, clock_time, identifier_uuid, test_block)
|
18
18
|
|
19
19
|
set_store_entity(handler, entity, entity_version)
|
20
20
|
set_clock_time(handler, clock_time)
|
@@ -53,7 +53,7 @@ module Messaging
|
|
53
53
|
context "Handler: #{handler.class.name.split('::').last}" do
|
54
54
|
detail "Handler Class: #{handler.class.name}"
|
55
55
|
|
56
|
-
if
|
56
|
+
if test_block.nil?
|
57
57
|
raise Error, "Handler fixture must be executed with a block"
|
58
58
|
end
|
59
59
|
|
@@ -70,30 +70,30 @@ module Messaging
|
|
70
70
|
|
71
71
|
handler.(input_message)
|
72
72
|
|
73
|
-
|
73
|
+
test_block.call(self)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
def assert_input_message(&
|
77
|
+
def assert_input_message(&test_block)
|
78
78
|
context_name = "Input Message"
|
79
79
|
if not input_message.nil?
|
80
80
|
context_name = "#{context_name}: #{input_message.class.message_type}"
|
81
81
|
end
|
82
82
|
|
83
|
-
fixture(Message, input_message, title_context_name: context_name, &
|
83
|
+
fixture(Message, input_message, title_context_name: context_name, &test_block)
|
84
84
|
end
|
85
85
|
|
86
|
-
def assert_written_message(written_message, &
|
86
|
+
def assert_written_message(written_message, &test_block)
|
87
87
|
context_name = "Written Message"
|
88
88
|
if not written_message.nil?
|
89
89
|
context_name = "#{context_name}: #{written_message.class.message_type}"
|
90
90
|
end
|
91
91
|
|
92
|
-
fixture(Message, written_message, input_message, title_context_name: context_name, &
|
92
|
+
fixture(Message, written_message, input_message, title_context_name: context_name, &test_block)
|
93
93
|
end
|
94
94
|
|
95
|
-
def assert_write(message_class, &
|
96
|
-
fixture = fixture(Write, handler.write, message_class, &
|
95
|
+
def assert_write(message_class, &test_block)
|
96
|
+
fixture = fixture(Write, handler.write, message_class, &test_block)
|
97
97
|
fixture.message
|
98
98
|
end
|
99
99
|
|
@@ -26,17 +26,17 @@ module Messaging
|
|
26
26
|
@title_context_name ||= "Message"
|
27
27
|
end
|
28
28
|
|
29
|
-
initializer :message, :source_message, na(:title_context_name), :
|
29
|
+
initializer :message, :source_message, na(:title_context_name), :test_block
|
30
30
|
|
31
|
-
def self.build(message, source_message=nil, title_context_name: nil, &
|
32
|
-
new(message, source_message, title_context_name,
|
31
|
+
def self.build(message, source_message=nil, title_context_name: nil, &test_block)
|
32
|
+
new(message, source_message, title_context_name, test_block)
|
33
33
|
end
|
34
34
|
|
35
35
|
def call
|
36
36
|
context_name = title_context_name
|
37
37
|
|
38
38
|
context context_name do
|
39
|
-
if
|
39
|
+
if test_block.nil?
|
40
40
|
raise Error, "Message fixture must be executed with a block"
|
41
41
|
end
|
42
42
|
|
@@ -55,7 +55,7 @@ module Messaging
|
|
55
55
|
detail "Source Message Class: #{source_message_class.name}"
|
56
56
|
end
|
57
57
|
|
58
|
-
|
58
|
+
test_block.call(self)
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -89,12 +89,12 @@ module Messaging
|
|
89
89
|
)
|
90
90
|
end
|
91
91
|
|
92
|
-
def assert_metadata(&
|
92
|
+
def assert_metadata(&test_block)
|
93
93
|
fixture(
|
94
94
|
Metadata,
|
95
95
|
message.metadata,
|
96
96
|
source_message&.metadata,
|
97
|
-
&
|
97
|
+
&test_block
|
98
98
|
)
|
99
99
|
end
|
100
100
|
|
@@ -6,15 +6,15 @@ module Messaging
|
|
6
6
|
include TestBench::Fixture
|
7
7
|
include Initializer
|
8
8
|
|
9
|
-
initializer :metadata, :source_metadata, :
|
9
|
+
initializer :metadata, :source_metadata, :test_block
|
10
10
|
|
11
|
-
def self.build(metadata, source_metadata=nil, &
|
12
|
-
new(metadata, source_metadata,
|
11
|
+
def self.build(metadata, source_metadata=nil, &test_block)
|
12
|
+
new(metadata, source_metadata, test_block)
|
13
13
|
end
|
14
14
|
|
15
15
|
def call
|
16
16
|
context "Metadata" do
|
17
|
-
if
|
17
|
+
if test_block.nil?
|
18
18
|
raise Error, "Metadata fixture must be executed with a block"
|
19
19
|
end
|
20
20
|
|
@@ -22,7 +22,7 @@ module Messaging
|
|
22
22
|
test "Not nil" do
|
23
23
|
detail "Metadata: nil"
|
24
24
|
|
25
|
-
if not
|
25
|
+
if not test_block.nil?
|
26
26
|
detail "Remaining message tests are skipped"
|
27
27
|
end
|
28
28
|
|
@@ -31,7 +31,7 @@ module Messaging
|
|
31
31
|
return
|
32
32
|
end
|
33
33
|
|
34
|
-
|
34
|
+
test_block.call(self)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -6,9 +6,9 @@ module Messaging
|
|
6
6
|
include TestBench::Fixture
|
7
7
|
include Initializer
|
8
8
|
|
9
|
-
initializer :message, :stream_name, :expected_version, :reply_stream_name, :
|
9
|
+
initializer :message, :stream_name, :expected_version, :reply_stream_name, :test_block
|
10
10
|
|
11
|
-
def self.build(writer, message_class, &
|
11
|
+
def self.build(writer, message_class, &test_block)
|
12
12
|
data = get_data(writer, message_class)
|
13
13
|
|
14
14
|
message = data&.message
|
@@ -16,7 +16,7 @@ module Messaging
|
|
16
16
|
expected_version = data&.expected_version
|
17
17
|
reply_stream_name = data&.reply_stream_name
|
18
18
|
|
19
|
-
new(message, stream_name, expected_version, reply_stream_name,
|
19
|
+
new(message, stream_name, expected_version, reply_stream_name, test_block)
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.get_data(writer, message_class)
|
@@ -46,7 +46,7 @@ module Messaging
|
|
46
46
|
end
|
47
47
|
|
48
48
|
context context_name do
|
49
|
-
if
|
49
|
+
if test_block.nil?
|
50
50
|
raise Error, "Write fixture must be executed with a block"
|
51
51
|
end
|
52
52
|
|
@@ -55,7 +55,7 @@ module Messaging
|
|
55
55
|
written = !message.nil?
|
56
56
|
|
57
57
|
test "Written" do
|
58
|
-
if not
|
58
|
+
if not test_block.nil?
|
59
59
|
detail "Remaining message tests are skipped"
|
60
60
|
end
|
61
61
|
|
@@ -64,7 +64,7 @@ module Messaging
|
|
64
64
|
|
65
65
|
return if !written
|
66
66
|
|
67
|
-
|
67
|
+
test_block.call(self)
|
68
68
|
end
|
69
69
|
|
70
70
|
message
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evt-messaging-fixtures
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Eventide Project
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evt-entity_store
|