evt-messaging-fixtures 1.1.2.3 → 1.1.6.1

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: 2a56c89ec94af46f6a188d41da68c9bab488386989b93c57c01632f81182e25e
4
- data.tar.gz: d7b5fa5dfa95b190e31458ca865877b1a115455867eebbda25b4c88d71132e63
3
+ metadata.gz: 7939863e15b5c4b69fba49236ce25c25c0ea77287cddafb4c7f9b2bbd30e837f
4
+ data.tar.gz: be6103c28d07826cb0424ed716d8499c3ecaaf879ac087dc983b61f3d7ebe4c6
5
5
  SHA512:
6
- metadata.gz: ef63c97d530ecef05272847f01e34b401733362520516d97adfac3c30d028385f16bb742ca3364fa29f1dcccb60f5d1cca9c2f09d1682f5d741d565e660cb093
7
- data.tar.gz: 6fc7e5c53073b39513abb03c5ce3f6fbbc053cb54ed425f46d27d943e0c00387b74b5a2f727d794c9e5662ff822bb35dbc8f53034f358e748a7d51f80e543a76
6
+ metadata.gz: f9dc5bc0a604cf7405540e8453da4ad2242d042538d0902c06f04dd90459bb55c2735c6fa863c8690c1c3c28e93ff965b12f05159b53bf02c123891b144bff9c
7
+ data.tar.gz: 89b10eaefcac75ed55b24ab68fc1f7a2de2999f3a1ff3b5ad04852303c82cf75ea1fd85d656c203edbbc9f4c86968288b465e2ba8851357f331c0d92d7d8cd6b
@@ -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
@@ -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.3
4
+ version: 1.1.6.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-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