evt-messaging-fixtures 1.1.2.2 → 1.1.6.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: 8312a954b5f432236fff5110a3b8e7995aa31eedcdf28ae01c159a25b85ed195
4
- data.tar.gz: 9d42fd7058998687de8b4317e592129c8ad0564275c697ae61a0b193dde575d7
3
+ metadata.gz: 53fcdc610e9e29195bf0f7d766128d11d4865ddebad1c1e0bbabde782a7744e7
4
+ data.tar.gz: 833439a2bf9d9aa9b8ee9b5577e8aab197c2a03080991e5d7675f03bc78523b2
5
5
  SHA512:
6
- metadata.gz: 28d1fc132b099276109c76abdd5ad07783a6a4247664efcbceccf368e481bb7af0a5f954eb9e6497827ca07f256ff3279ad0fb6c4249b4891ebcf095fd5e922f
7
- data.tar.gz: dec2f6285a30768713723b615de98642103cdcce69f9a6bc05de6c9ffa1ceab68719216dec55a577464f3df1b049bb699fcdc272b56188be0cb95ffd6a86ce11
6
+ metadata.gz: 8abb764a715efcebd5c7c031fb5479faae0f4fc344078bde01b0db065df3fd46e5f0d0ca599ba1dfa31c25cde4365533e9599e9fa3bc7ba905489fa69af3c6e8
7
+ data.tar.gz: 5af2c1081e4610e93959e2cb7de62f40cac4a79b0c1c5631ffd061d3fbe59288faf9aa4bde2f90ff8542b6dba3cbeb733fb97a692aacf25bd4cad3a6f632587b
@@ -17,6 +17,8 @@ module Messaging
17
17
 
18
18
  metadata.reply_stream_name = reply_stream_name
19
19
 
20
+ metadata.properties = properties
21
+
20
22
  metadata.time = time
21
23
 
22
24
  metadata.schema_version = schema_version
@@ -56,6 +58,12 @@ module Messaging
56
58
  'someReplyStream'
57
59
  end
58
60
 
61
+ def self.properties
62
+ {
63
+ some_property: 'some property value'
64
+ }
65
+ end
66
+
59
67
  def self.time
60
68
  ::Time.utc(2000, 1, 1, 0, 0, 0, 11)
61
69
  end
@@ -34,19 +34,19 @@ module Messaging
34
34
 
35
35
  def call!
36
36
  test "Follows" do
37
- detail "Stream Name: #{source_metadata.stream_name.inspect}"
37
+ detail "Source Message Stream Name: #{source_metadata.stream_name.inspect}"
38
38
  detail "Causation Stream Name: #{metadata.causation_message_stream_name.inspect}"
39
39
 
40
- detail "Position: #{source_metadata.position.inspect}"
40
+ detail "Source Message Position: #{source_metadata.position.inspect}"
41
41
  detail "Causation Position: #{metadata.causation_message_position.inspect}"
42
42
 
43
- detail "Global Position: #{source_metadata.global_position.inspect}"
43
+ detail "Source Message Global Position: #{source_metadata.global_position.inspect}"
44
44
  detail "Causation Global Position: #{metadata.causation_message_global_position.inspect}"
45
45
 
46
- detail "Source Correlation Stream Name: #{source_metadata.correlation_stream_name.inspect}"
46
+ detail "Source Message Correlation Stream Name: #{source_metadata.correlation_stream_name.inspect}"
47
47
  detail "Correlation Stream Name: #{metadata.correlation_stream_name.inspect}"
48
48
 
49
- detail "Source Reply Stream Name: #{source_metadata.reply_stream_name.inspect}"
49
+ detail "Source Message Reply Stream Name: #{source_metadata.reply_stream_name.inspect}"
50
50
  detail "Reply Stream Name: #{metadata.reply_stream_name.inspect}"
51
51
 
52
52
  assert(metadata.follows?(source_metadata))
@@ -11,22 +11,24 @@ module Messaging
11
11
  entity.sequence
12
12
  end
13
13
 
14
- initializer :handler, :input_message, :entity, :entity_version, :clock_time, :identifier_uuid, :test_block
14
+ initializer :handler, :input_message, :entity, :entity_version, :entity_id, :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, &test_block)
17
- instance = new(handler, input_message, entity, entity_version, clock_time, identifier_uuid, test_block)
16
+ def self.build(handler, input_message, entity=nil, entity_version=nil, entity_id=nil, clock_time: nil, identifier_uuid: nil, &test_block)
17
+ instance = new(handler, input_message, entity, entity_version, entity_id, clock_time, identifier_uuid, test_block)
18
18
 
19
- set_store_entity(handler, entity, entity_version)
19
+ set_store_entity(handler, entity, entity_version, entity_id)
20
20
  set_clock_time(handler, clock_time)
21
21
  set_identifier_uuid(handler, identifier_uuid)
22
22
 
23
23
  instance
24
24
  end
25
25
 
26
- def self.set_store_entity(handler, entity, entity_version)
26
+ def self.set_store_entity(handler, entity, entity_version, entity_id)
27
27
  return if entity.nil?
28
28
 
29
- handler.store.add(entity.id, entity, entity_version)
29
+ entity_id ||= entity.id
30
+
31
+ handler.store.add(entity_id, entity, entity_version)
30
32
  end
31
33
 
32
34
  def self.set_clock_time(handler, clock_time)
@@ -22,6 +22,13 @@ module Messaging
22
22
  source_message_class.name.split('::').last
23
23
  end
24
24
 
25
+ def print_title_context?
26
+ if @print_title_context.nil?
27
+ @print_title_context = true
28
+ end
29
+ @print_title_context
30
+ end
31
+
25
32
  def title_context_name
26
33
  if @title_context_name.nil?
27
34
  @title_context_name = "Message"
@@ -34,37 +41,52 @@ module Messaging
34
41
  @title_context_name
35
42
  end
36
43
 
37
- initializer :message, :source_message, na(:title_context_name), :test_block
44
+ def detail_message_class?
45
+ if @detail_message_class.nil?
46
+ @detail_message_class = true
47
+ end
48
+ @detail_message_class
49
+ end
38
50
 
39
- def self.build(message, source_message=nil, title_context_name: nil, &test_block)
40
- new(message, source_message, title_context_name, test_block)
51
+ initializer :message, :source_message, na(:print_title_context), na(:title_context_name), na(:detail_message_class), :test_block
52
+
53
+ def self.build(message, source_message=nil, print_title_context: nil, title_context_name: nil, detail_message_class: nil, &test_block)
54
+ new(message, source_message, print_title_context, title_context_name, detail_message_class, test_block)
41
55
  end
42
56
 
43
57
  def call
44
- context_name = title_context_name
45
-
46
- context context_name do
47
- if test_block.nil?
48
- raise Error, "Message fixture must be executed with a block"
58
+ if print_title_context?
59
+ context "#{title_context_name}" do
60
+ call!
49
61
  end
62
+ else
63
+ call!
64
+ end
65
+ end
50
66
 
51
- if message.nil?
52
- test "Not nil" do
53
- detail "Message: nil"
54
- detail "Remaining message tests are skipped"
55
- refute(message.nil?)
56
- end
57
- return
67
+ def call!
68
+ if test_block.nil?
69
+ raise Error, "Message fixture must be executed with a block"
70
+ end
71
+
72
+ if message.nil?
73
+ test "Not nil" do
74
+ detail "Message: nil"
75
+ detail "Remaining message tests are skipped"
76
+ refute(message.nil?)
58
77
  end
78
+ return
79
+ end
59
80
 
81
+ if detail_message_class?
60
82
  detail "Message Class: #{message_class.name}"
83
+ end
61
84
 
62
- if not source_message.nil?
63
- detail "Source Message Class: #{source_message_class.name}"
64
- end
65
-
66
- test_block.call(self)
85
+ if not source_message.nil?
86
+ detail "Source Message Class: #{source_message_class.name}"
67
87
  end
88
+
89
+ test_block.call(self)
68
90
  end
69
91
 
70
92
  def assert_attributes_assigned(attribute_names=nil)
@@ -38,7 +38,10 @@ module Messaging
38
38
  def assert_attributes_assigned(attribute_names=nil, context_title_qualifier: nil)
39
39
  attribute_names ||= Messaging::Message::Metadata.all_attribute_names
40
40
 
41
- attributes_context_title = "#{context_title_qualifier} Attributes Assigned".lstrip
41
+ attributes_text = "Attribute"
42
+ attributes_text = attribute_names.length == 1 ? attributes_text : "#{attributes_text}s"
43
+
44
+ attributes_context_title = "#{context_title_qualifier} #{attributes_text} Assigned".lstrip
42
45
 
43
46
  fixture(
44
47
  Schema::Fixtures::Assignment,
@@ -74,6 +77,20 @@ module Messaging
74
77
  end
75
78
  end
76
79
 
80
+ def assert_correlation_stream_name_assigned
81
+ control_metadata = Messaging::Message::Metadata.new
82
+ default_correlation_stream_name = control_metadata.correlation_stream_name
83
+
84
+ correlation_stream_name = metadata.correlation_stream_name
85
+
86
+ test "Correlation stream name assigned" do
87
+ detail "Default Value: #{default_correlation_stream_name.inspect}"
88
+ detail "Assigned Value: #{correlation_stream_name.inspect}"
89
+
90
+ refute(correlation_stream_name == default_correlation_stream_name)
91
+ end
92
+ end
93
+
77
94
  def assert_reply_stream_name(reply_stream_name)
78
95
  metadata_value = metadata.reply_stream_name
79
96
 
@@ -84,6 +101,20 @@ module Messaging
84
101
  end
85
102
  end
86
103
 
104
+ def assert_reply_stream_name_assigned
105
+ control_metadata = Messaging::Message::Metadata.new
106
+ default_reply_stream_name = control_metadata.reply_stream_name
107
+
108
+ reply_stream_name = metadata.reply_stream_name
109
+
110
+ test "Reply stream name assigned" do
111
+ detail "Default Value: #{default_reply_stream_name.inspect}"
112
+ detail "Assigned Value: #{reply_stream_name.inspect}"
113
+
114
+ refute(reply_stream_name == default_reply_stream_name)
115
+ end
116
+ end
117
+
87
118
  def assert_follows
88
119
  fixture(Follows, metadata, source_metadata)
89
120
  end
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.1.2.2
4
+ version: 1.1.6.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-30 00:00:00.000000000 Z
11
+ date: 2020-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-entity_store