evt-messaging-fixtures 0.0.0.1 → 1.0.0.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: 269b46f51f2dd3d63cd7f1655e281cf702300d0a9044b69d96dbc4a26eb7797b
4
- data.tar.gz: 2d45a9b841af0036cd172070448ee5dd00caa27137e6ccc31b8b1a11914ced71
3
+ metadata.gz: 8f3171c20b3fd5d5255db7dd0ea88ce246ea703d7d05c82907af753714d2fcba
4
+ data.tar.gz: cdfaa3633ae26dd1d90eaaf003932e927d9d7892b9693204b80a1d07e7f54f21
5
5
  SHA512:
6
- metadata.gz: 708b275d3d264c5f6d43ab01db849cabae52cb9cf7b10baee26f985db40e9209c62e68a4d6d6c453a1e22135adf6b58c70f21e3a84b6084427bacd64db691d9a
7
- data.tar.gz: 96c40f8d25a8ec8d33acef440b81d815ea2fa2045562e4843ba2a1ff08a94878ff634db7784b160a2e9b0d733359df779dd0d5b3a0db620e7afc574ee0891750
6
+ metadata.gz: 4b8e32dafbdbbbf33c8e0b57553303adcb08573f9acf5c6fedefb47b3d66026f320be590f03de8f2f8eea648c13c00d289d44b794951ebff3e2819f79760e89f
7
+ data.tar.gz: 3d764a901687dc32e4da976a4d9671f6fc20c8952e5429195e593826a919467fde92d197ff3895b1dbc5a0ad3439f915b383fcab71cc2fb927c8ea55de3b34aa
@@ -3,7 +3,8 @@ require 'schema/fixtures'
3
3
  require 'entity_store'
4
4
 
5
5
  require 'messaging/fixtures/defaults'
6
- require 'messaging/fixtures/input_message'
7
- require 'messaging/fixtures/written_message'
6
+ require 'messaging/fixtures/follows'
7
+ require 'messaging/fixtures/metadata'
8
+ require 'messaging/fixtures/message'
8
9
  require 'messaging/fixtures/write'
9
10
  require 'messaging/fixtures/handler'
@@ -2,6 +2,7 @@ require 'messaging/controls'
2
2
 
3
3
  require 'messaging/fixtures/controls/id'
4
4
  require 'messaging/fixtures/controls/time'
5
+ require 'messaging/fixtures/controls/metadata'
5
6
  require 'messaging/fixtures/controls/message'
6
7
  require 'messaging/fixtures/controls/event'
7
8
  require 'messaging/fixtures/controls/sequence'
@@ -45,18 +45,26 @@ module Messaging
45
45
 
46
46
  if example.alternate_condition?
47
47
  alternate_output = Controls::Event::AlternateOutput.follow(input, copy: attributes)
48
+
48
49
  alternate_output.processed_time = time
49
50
  alternate_output.sequence = sequence
50
51
 
52
+ alternate_output.metadata.correlation_stream_name = 'someCorrelationStream'
53
+ alternate_output.metadata.reply_stream_name = 'someReplyStream'
54
+
51
55
  write.(alternate_output, stream_name, expected_version: version)
52
56
 
53
57
  return
54
58
  end
55
59
 
56
60
  output = Controls::Event::Output.follow(input, copy: attributes)
61
+
57
62
  output.processed_time = time
58
63
  output.sequence = sequence
59
64
 
65
+ output.metadata.correlation_stream_name = 'someCorrelationStream'
66
+ output.metadata.reply_stream_name = 'someReplyStream'
67
+
60
68
  write.(output, stream_name, expected_version: version)
61
69
  end
62
70
  end
@@ -38,6 +38,18 @@ module Messaging
38
38
  Metadata.example
39
39
  end
40
40
 
41
+ module SomeMessage
42
+ def self.example
43
+ Example.new
44
+ end
45
+
46
+ class Example
47
+ include Messaging::Message
48
+
49
+ attribute :some_attribute, String
50
+ end
51
+ end
52
+
41
53
  module Metadata
42
54
  def self.example
43
55
  metadata = Messaging::Message::Metadata.new
@@ -0,0 +1,69 @@
1
+ module Messaging
2
+ module Fixtures
3
+ module Controls
4
+ module Metadata
5
+ def self.example
6
+ metadata = Messaging::Message::Metadata.new
7
+
8
+ metadata.stream_name = stream_name
9
+ metadata.position = position
10
+ metadata.global_position = global_position
11
+
12
+ metadata.causation_message_stream_name = causation_message_stream_name
13
+ metadata.causation_message_position = causation_message_position
14
+ metadata.causation_message_global_position = causation_message_global_position
15
+
16
+ metadata.correlation_stream_name = correlation_stream_name
17
+
18
+ metadata.reply_stream_name = reply_stream_name
19
+
20
+ metadata.time = time
21
+
22
+ metadata.schema_version = schema_version
23
+
24
+ metadata
25
+ end
26
+
27
+ def self.stream_name
28
+ "example:command-#{Entity.id}"
29
+ end
30
+
31
+ def self.position
32
+ 1
33
+ end
34
+
35
+ def self.global_position
36
+ 111
37
+ end
38
+
39
+ def self.causation_message_stream_name
40
+ Message::Metadata.stream_name
41
+ end
42
+
43
+ def self.causation_message_position
44
+ Message::Metadata.position
45
+ end
46
+
47
+ def self.causation_message_global_position
48
+ Message::Metadata.global_position
49
+ end
50
+
51
+ def self.correlation_stream_name
52
+ 'someCorrelationStream'
53
+ end
54
+
55
+ def self.reply_stream_name
56
+ 'someReplyStream'
57
+ end
58
+
59
+ def self.time
60
+ ::Time.utc(2000, 1, 1, 0, 0, 0, 11)
61
+ end
62
+
63
+ def self.schema_version
64
+ '1'
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -2,11 +2,11 @@ module Messaging
2
2
  module Fixtures
3
3
  class Handler
4
4
  module Defaults
5
- def self.time
5
+ def self.clock_time
6
6
  Time.utc(2000, 1, 1, 0, 0, 0, 11)
7
7
  end
8
8
 
9
- def self.uuid
9
+ def self.identifier_uuid
10
10
  Identifier::UUID.zero
11
11
  end
12
12
  end
@@ -0,0 +1,57 @@
1
+ module Messaging
2
+ module Fixtures
3
+ class Follows
4
+ include TestBench::Fixture
5
+ include Initializer
6
+
7
+ initializer :metadata, :source_metadata
8
+
9
+ def self.build(metadata, source_metadata=nil)
10
+ new(metadata, source_metadata)
11
+ end
12
+
13
+ def call
14
+ context do
15
+ if metadata.nil?
16
+ test "Metadata not nil" do
17
+ detail "Metadata: nil"
18
+ refute(metadata.nil?)
19
+ end
20
+ return
21
+ end
22
+
23
+ if source_metadata.nil?
24
+ test "Source metadata not nil" do
25
+ detail "Source Metadata: nil"
26
+ refute(source_metadata.nil?)
27
+ end
28
+ return
29
+ end
30
+
31
+ call!
32
+ end
33
+ end
34
+
35
+ def call!
36
+ test "Follows" do
37
+ detail "Stream Name: #{source_metadata.stream_name.inspect}"
38
+ detail "Causation Stream Name: #{metadata.causation_message_stream_name.inspect}"
39
+
40
+ detail "Position: #{source_metadata.position.inspect}"
41
+ detail "Causation Position: #{metadata.causation_message_position.inspect}"
42
+
43
+ detail "Global Position: #{source_metadata.global_position.inspect}"
44
+ detail "Causation Global Position: #{metadata.causation_message_global_position.inspect}"
45
+
46
+ detail "Source Correlation Stream Name: #{source_metadata.correlation_stream_name.inspect}"
47
+ detail "Correlation Stream Name: #{metadata.correlation_stream_name.inspect}"
48
+
49
+ detail "Source Reply Stream Name: #{source_metadata.reply_stream_name.inspect}"
50
+ detail "Reply Stream Name: #{metadata.reply_stream_name.inspect}"
51
+
52
+ assert(metadata.follows?(source_metadata))
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -1,6 +1,8 @@
1
1
  module Messaging
2
2
  module Fixtures
3
3
  class Handler
4
+ Error = Class.new(RuntimeError)
5
+
4
6
  include TestBench::Fixture
5
7
  include Initializer
6
8
 
@@ -9,14 +11,14 @@ module Messaging
9
11
  entity.sequence
10
12
  end
11
13
 
12
- initializer :handler, :input_message, :entity, :entity_version, :time, :uuid, :action
14
+ initializer :handler, :input_message, :entity, :entity_version, :clock_time, :identifier_uuid, :action
13
15
 
14
- def self.build(handler, input_message, entity=nil, entity_version=nil, time: nil, uuid: nil, &action)
15
- instance = new(handler, input_message, entity, entity_version, time, uuid, action)
16
+ def self.build(handler, input_message, entity=nil, entity_version=nil, clock_time: nil, identifier_uuid: nil, &action)
17
+ instance = new(handler, input_message, entity, entity_version, clock_time, identifier_uuid, action)
16
18
 
17
19
  set_store_entity(handler, entity, entity_version)
18
- set_clock_time(handler, time)
19
- set_identifier_uuid(handler, uuid)
20
+ set_clock_time(handler, clock_time)
21
+ set_identifier_uuid(handler, identifier_uuid)
20
22
 
21
23
  instance
22
24
  end
@@ -27,23 +29,23 @@ module Messaging
27
29
  handler.store.add(entity.id, entity, entity_version)
28
30
  end
29
31
 
30
- def self.set_clock_time(handler, time)
31
- if time.nil?
32
+ def self.set_clock_time(handler, clock_time)
33
+ if clock_time.nil?
32
34
  if handler.respond_to?(:clock)
33
- handler.clock.now = Defaults.time
35
+ handler.clock.now = Defaults.clock_time
34
36
  end
35
37
  else
36
- handler.clock.now = time
38
+ handler.clock.now = clock_time
37
39
  end
38
40
  end
39
41
 
40
- def self.set_identifier_uuid(handler, uuid)
41
- if uuid.nil?
42
+ def self.set_identifier_uuid(handler, identifier_uuid)
43
+ if identifier_uuid.nil?
42
44
  if handler.respond_to?(:identifier)
43
- handler.identifier.set(Defaults.uuid)
45
+ handler.identifier.set(Defaults.identifier_uuid)
44
46
  end
45
47
  else
46
- handler.identifier.set(uuid)
48
+ handler.identifier.set(identifier_uuid)
47
49
  end
48
50
  end
49
51
 
@@ -51,52 +53,69 @@ module Messaging
51
53
  context "Handler: #{handler.class.name.split('::').last}" do
52
54
  detail "Handler Class: #{handler.class.name}"
53
55
 
56
+ if action.nil?
57
+ raise Error, "Handler fixture must be executed with a block"
58
+ end
59
+
54
60
  detail "Entity Class: #{entity.class.name}"
55
- detail "Entity Data: #{entity&.attributes}"
61
+ detail "Entity Data: #{entity&.attributes.inspect}"
56
62
 
57
- handler.(input_message)
63
+ if not clock_time.nil?
64
+ detail "Clock Time: #{clock_time.inspect}"
65
+ end
58
66
 
59
- if not action.nil?
60
- action.call(self)
67
+ if not identifier_uuid.nil?
68
+ detail "Identifier UUID: #{identifier_uuid}"
61
69
  end
70
+
71
+ handler.(input_message)
72
+
73
+ action.call(self)
62
74
  end
63
75
  end
64
76
 
65
- def assert_write(message_class, &action)
66
- fixture = fixture(Write, handler.write, message_class, &action)
77
+ def assert_input_message(&action)
78
+ context_name = "Input Message"
79
+ if not input_message.nil?
80
+ context_name = "#{context_name}: #{input_message.class.message_type}"
81
+ end
67
82
 
68
- output_message = fixture.message
83
+ fixture(Message, input_message, title_context_name: context_name, &action)
84
+ end
69
85
 
70
- if not output_message.nil?
71
- TestBench::Fixture.build(WrittenMessage, output_message, input_message, session: test_session)
72
- else
73
- Mimic.(WrittenMessage)
86
+ def assert_written_message(written_message, &action)
87
+ context_name = "Written Message"
88
+ if not written_message.nil?
89
+ context_name = "#{context_name}: #{written_message.class.message_type}"
74
90
  end
91
+
92
+ fixture(Message, written_message, input_message, title_context_name: context_name, &action)
93
+ end
94
+
95
+ def assert_write(message_class, &action)
96
+ fixture = fixture(Write, handler.write, message_class, &action)
97
+ fixture.message
75
98
  end
76
99
 
77
100
  def refute_write(message_class=nil)
78
101
  writer = handler.write
79
102
 
80
- context_title = "No Write"
103
+ context_name = "No Write"
81
104
  if not message_class.nil?
82
105
  write_telemetry_data = Write.get_data(writer, message_class)
83
106
  written = !write_telemetry_data.nil?
84
- context_title = "#{context_title}: #{message_class.message_type}"
107
+ context_name = "#{context_name}: #{message_class.message_type}"
85
108
  else
86
109
  written = writer.written?
87
110
  end
88
111
 
89
- context context_title do
112
+ context context_name do
90
113
  detail "Message Class: #{message_class.inspect}"
91
114
  test "Not written" do
92
115
  refute(written)
93
116
  end
94
117
  end
95
118
  end
96
-
97
- def assert_input_message(attributes=nil, &action)
98
- fixture = fixture(InputMessage, input_message, &action)
99
- end
100
119
  end
101
120
  end
102
121
  end
@@ -0,0 +1,123 @@
1
+ module Messaging
2
+ module Fixtures
3
+ class Message
4
+ Error = Class.new(RuntimeError)
5
+
6
+ include TestBench::Fixture
7
+ include Initializer
8
+
9
+ def message_class
10
+ message.class
11
+ end
12
+
13
+ def message_type
14
+ message_class.name.split('::').last
15
+ end
16
+
17
+ def source_message_class
18
+ source_message.class
19
+ end
20
+
21
+ def source_message_type
22
+ source_message_class.name.split('::').last
23
+ end
24
+
25
+ def title_context_name
26
+ @title_context_name ||= "Message"
27
+ end
28
+
29
+ initializer :message, :source_message, na(:title_context_name), :action
30
+
31
+ def self.build(message, source_message=nil, title_context_name: nil, &action)
32
+ new(message, source_message, title_context_name, action)
33
+ end
34
+
35
+ def call
36
+ context_name = title_context_name
37
+
38
+ context context_name do
39
+ if action.nil?
40
+ raise Error, "Message fixture must be executed with a block"
41
+ end
42
+
43
+ if message.nil?
44
+ test "Not nil" do
45
+ detail "Message: nil"
46
+ detail "Remaining message tests are skipped"
47
+ refute(message.nil?)
48
+ end
49
+ return
50
+ end
51
+
52
+ detail "Message Class: #{message_class.name}"
53
+
54
+ if not source_message.nil?
55
+ detail "Source Message Class: #{source_message_class.name}"
56
+ end
57
+
58
+ action.call(self)
59
+ end
60
+ end
61
+
62
+ def assert_attributes_assigned(attribute_names=nil)
63
+ fixture(
64
+ Schema::Fixtures::Assignment,
65
+ message,
66
+ attribute_names,
67
+ print_title_context: false,
68
+ attributes_context_name: "Attributes Assigned"
69
+ )
70
+ end
71
+
72
+ def assert_attributes_copied(attribute_names=nil)
73
+ if source_message.nil?
74
+ test "Source message not nil" do
75
+ detail "Source Message: nil"
76
+ refute(source_message.nil?)
77
+ end
78
+ return
79
+ end
80
+
81
+ fixture(
82
+ Schema::Fixtures::Equality,
83
+ source_message,
84
+ message,
85
+ attribute_names,
86
+ ignore_class: true,
87
+ print_title_context: false,
88
+ attributes_context_name: "Attributes Copied: #{source_message_type} => #{message_type}"
89
+ )
90
+ end
91
+
92
+ def assert_metadata(&action)
93
+ fixture(
94
+ Metadata,
95
+ message.metadata,
96
+ source_message&.metadata,
97
+ &action
98
+ )
99
+ end
100
+
101
+ def assert_follows
102
+ metadata = message.metadata
103
+ source_metadata = source_message&.metadata
104
+
105
+ fixture(Follows, metadata, source_metadata)
106
+ end
107
+
108
+ def assert_attribute_value(name, value)
109
+ context "Attribute Value" do
110
+ attribute_value = message.public_send(name)
111
+
112
+ test "#{name}" do
113
+ detail "Attribute Value: #{attribute_value.inspect}"
114
+ detail "Compare Value: #{value.inspect}"
115
+
116
+ assert(attribute_value == value)
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end
122
+ end
123
+
@@ -0,0 +1,92 @@
1
+ module Messaging
2
+ module Fixtures
3
+ class Metadata
4
+ Error = Class.new(RuntimeError)
5
+
6
+ include TestBench::Fixture
7
+ include Initializer
8
+
9
+ initializer :metadata, :source_metadata, :action
10
+
11
+ def self.build(metadata, source_metadata=nil, &action)
12
+ new(metadata, source_metadata, action)
13
+ end
14
+
15
+ def call
16
+ context "Metadata" do
17
+ if action.nil?
18
+ raise Error, "Metadata fixture must be executed with a block"
19
+ end
20
+
21
+ if metadata.nil?
22
+ test "Not nil" do
23
+ detail "Metadata: nil"
24
+
25
+ if not action.nil?
26
+ detail "Remaining message tests are skipped"
27
+ end
28
+
29
+ refute(metadata.nil?)
30
+ end
31
+ return
32
+ end
33
+
34
+ action.call(self)
35
+ end
36
+ end
37
+
38
+ def assert_attributes_assigned(attribute_names=nil, context_title_qualifier: nil)
39
+ attribute_names ||= Messaging::Message::Metadata.all_attribute_names
40
+
41
+ attributes_context_title = "#{context_title_qualifier} Attributes Assigned".lstrip
42
+
43
+ fixture(
44
+ Schema::Fixtures::Assignment,
45
+ metadata,
46
+ attribute_names,
47
+ print_title_context: false,
48
+ attributes_context_name: attributes_context_title
49
+ )
50
+ end
51
+
52
+ def assert_source_attributes_assigned
53
+ attribute_names = Messaging::Message::Metadata.source_attribute_names
54
+ assert_attributes_assigned(attribute_names, context_title_qualifier: 'Source')
55
+ end
56
+
57
+ def assert_workflow_attributes_assigned
58
+ attribute_names = Messaging::Message::Metadata.workflow_attribute_names
59
+ assert_attributes_assigned(attribute_names, context_title_qualifier: 'Workflow')
60
+ end
61
+
62
+ def assert_causation_attributes_assigned
63
+ attribute_names = Messaging::Message::Metadata.causation_attribute_names
64
+ assert_attributes_assigned(attribute_names, context_title_qualifier: 'Causation')
65
+ end
66
+
67
+ def assert_correlation_stream_name(correlation_stream_name)
68
+ metadata_value = metadata.correlation_stream_name
69
+
70
+ test "correlation_stream_name" do
71
+ detail "Metadata Value: #{metadata_value}"
72
+ detail "Compare Value: #{correlation_stream_name}"
73
+ assert(metadata_value == correlation_stream_name)
74
+ end
75
+ end
76
+
77
+ def assert_reply_stream_name(reply_stream_name)
78
+ metadata_value = metadata.reply_stream_name
79
+
80
+ test "reply_stream_name" do
81
+ detail "Metadata Value: #{metadata_value}"
82
+ detail "Compare Value: #{reply_stream_name}"
83
+ assert(metadata_value == reply_stream_name)
84
+ end
85
+ end
86
+
87
+ def assert_follows
88
+ fixture(Follows, metadata, source_metadata)
89
+ end
90
+ end
91
+ end
92
+ end
@@ -40,20 +40,31 @@ module Messaging
40
40
  def call
41
41
  message_class = message&.class
42
42
 
43
- context "Write: #{message_class&.message_type || 'nil'}" do
43
+ context_name = 'Write'
44
+ if not message_class.nil?
45
+ context_name = "#{context_name}: #{message_class&.message_type}"
46
+ end
47
+
48
+ context context_name do
49
+ if action.nil?
50
+ raise Error, "Write fixture must be executed with a block"
51
+ end
52
+
44
53
  detail "Message Class: #{message_class.inspect}"
45
54
 
46
55
  written = !message.nil?
47
56
 
48
57
  test "Written" do
58
+ if not action.nil?
59
+ detail "Remaining message tests are skipped"
60
+ end
61
+
49
62
  assert(written)
50
63
  end
51
64
 
52
- return if !written || action.nil?
65
+ return if !written
53
66
 
54
- if not action.nil?
55
- action.call(self)
56
- end
67
+ action.call(self)
57
68
  end
58
69
 
59
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: 0.0.0.1
4
+ version: 1.0.0.0
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-02 00:00:00.000000000 Z
11
+ date: 2020-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-entity_store
@@ -65,14 +65,16 @@ files:
65
65
  - lib/messaging/fixtures/controls/handler.rb
66
66
  - lib/messaging/fixtures/controls/id.rb
67
67
  - lib/messaging/fixtures/controls/message.rb
68
+ - lib/messaging/fixtures/controls/metadata.rb
68
69
  - lib/messaging/fixtures/controls/sequence.rb
69
70
  - lib/messaging/fixtures/controls/store.rb
70
71
  - lib/messaging/fixtures/controls/time.rb
71
72
  - lib/messaging/fixtures/defaults.rb
73
+ - lib/messaging/fixtures/follows.rb
72
74
  - lib/messaging/fixtures/handler.rb
73
- - lib/messaging/fixtures/input_message.rb
75
+ - lib/messaging/fixtures/message.rb
76
+ - lib/messaging/fixtures/metadata.rb
74
77
  - lib/messaging/fixtures/write.rb
75
- - lib/messaging/fixtures/written_message.rb
76
78
  homepage: https://github.com/eventide-project/messaging-fixtures
77
79
  licenses:
78
80
  - MIT
@@ -1,52 +0,0 @@
1
- module Messaging
2
- module Fixtures
3
- class InputMessage
4
- Error = Class.new(RuntimeError)
5
-
6
- include TestBench::Fixture
7
- include Initializer
8
-
9
- initializer :input_message, :action
10
-
11
- def self.build(input_message, &action)
12
- new(input_message, action)
13
- end
14
-
15
- def call
16
- input_message_class = input_message.class
17
-
18
- context "Input Message: #{input_message_class.message_type}" do
19
- detail "Input Message Class: #{input_message_class.name}"
20
-
21
- if not action.nil?
22
- action.call(self)
23
- end
24
- end
25
- end
26
-
27
- def assert_attributes_assigned(attribute_names=nil)
28
- fixture(
29
- Schema::Fixtures::Assignment,
30
- input_message,
31
- attribute_names,
32
- print_title_context: false,
33
- attributes_context_name: "Attributes Assigned"
34
- )
35
- end
36
-
37
- def assert_metadata_attributes_assigned(attribute_names=nil)
38
- attribute_names = [:stream_name, :position, :global_position]
39
-
40
- metadata = input_message.metadata
41
-
42
- fixture(
43
- Schema::Fixtures::Assignment,
44
- metadata,
45
- attribute_names,
46
- print_title_context: false,
47
- attributes_context_name: "Metadata Attributes Assigned"
48
- )
49
- end
50
- end
51
- end
52
- end
@@ -1,84 +0,0 @@
1
- module Messaging
2
- module Fixtures
3
- class WrittenMessage
4
- Error = Class.new(RuntimeError)
5
-
6
- include TestBench::Fixture
7
- include Initializer
8
-
9
- initializer :output_message, :input_message
10
-
11
- def self.build(output_message, input_message)
12
- new(output_message, input_message)
13
- end
14
-
15
- def call(&action)
16
- input_message_class = input_message.class
17
- output_message_class = output_message.class
18
-
19
- context "Written Message: #{output_message_class.message_type}" do
20
- detail "Input Message Class: #{input_message_class.name}"
21
- detail "Written Message Class: #{output_message_class.name}"
22
-
23
- if not action.nil?
24
- action.call(self)
25
- end
26
- end
27
- end
28
-
29
- def assert_follows
30
- input_message_type = input_message.class.message_type
31
- output_message_type = output_message.class.message_type
32
-
33
- test "Follows: #{input_message_type}" do
34
- detail "#{input_message_type} Stream Name: #{input_message.metadata.stream_name.inspect}"
35
- detail "#{output_message_type} Causation Stream Name: #{output_message.metadata.causation_message_stream_name.inspect}"
36
-
37
- detail "#{input_message_type} Position: #{input_message.metadata.position.inspect}"
38
- detail "#{output_message_type} Causation Position: #{output_message.metadata.causation_message_position.inspect}"
39
-
40
- detail "#{input_message_type} Global Position: #{input_message.metadata.global_position.inspect}"
41
- detail "#{output_message_type} Causation Global Position: #{output_message.metadata.causation_message_global_position.inspect}"
42
-
43
- detail "#{input_message_type} Reply Stream Name: #{input_message.metadata.reply_stream_name.inspect}"
44
- detail "#{output_message_type} Reply Stream Name: #{output_message.metadata.reply_stream_name.inspect}"
45
-
46
- assert(output_message.follows?(input_message))
47
- end
48
- end
49
-
50
- def ___assert_attributes_copied(attribute_names=nil)
51
- fixture(
52
- Schema::Fixtures::Equality,
53
- input_message,
54
- output_message,
55
- attribute_names,
56
- ignore_class: true,
57
- title_context_name: "Attributes Copied: #{input_message.class.message_type} => #{output_message.class.message_type}"
58
- )
59
- end
60
-
61
- def assert_attributes_copied(attribute_names=nil)
62
- fixture(
63
- Schema::Fixtures::Equality,
64
- input_message,
65
- output_message,
66
- attribute_names,
67
- ignore_class: true,
68
- print_title_context: false,
69
- attributes_context_name: "Attributes Copied: #{input_message.class.message_type} => #{output_message.class.message_type}"
70
- )
71
- end
72
-
73
- def assert_attributes_assigned(attribute_names=nil)
74
- fixture(
75
- Schema::Fixtures::Assignment,
76
- output_message,
77
- attribute_names,
78
- print_title_context: false,
79
- attributes_context_name: "Attributes Assigned: #{output_message.class.message_type}"
80
- )
81
- end
82
- end
83
- end
84
- end