evt-messaging-fixtures 1.1.2.1 → 1.1.5.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: 85e9f2c72d37fc952f66845c220b61ef07bbbf20b104a349c8b5ac00664e5951
4
- data.tar.gz: 1d4dcad3c3c19e475b01539f6086725993051d4449402b2e9ee6e0ea85d174f4
3
+ metadata.gz: c45e6880790916902cbf5c52619e9cb15c335251079ca2ec027c7ca7710ab66e
4
+ data.tar.gz: 9558fee1ece3893923812f29aa81e9915d7cdf1fab91142924d383d453d942fd
5
5
  SHA512:
6
- metadata.gz: 9f2f55094442e66f12523930363ba14e9b39f08602d3e4869b34e4914301dbe03b78dfc9ad2420b62e26fb5143c69c9b1a11a417c4a30318af49fb25f798a7a8
7
- data.tar.gz: d67172e081b097e53d85efb55f894e02f80494222794f7976c79e860c3a0fba931c04fd2af247336099aee160784c2dbdb579af65a511ea220a93b22dc0760e2
6
+ metadata.gz: 3f17eb391bcdbccc5f5c14a366719282bdda6011d637fc4fab7c4cd832036f6b38b62c066622c83fee1fe9aa59894470e8f5093ca53179f18701976c8d540df1
7
+ data.tar.gz: bb05a8dae9020bec28f66478a1802b089ed4d644364f90d35dc050e3eca393bdbc8001a2f76b45d0fdb53b60aaca8595c03fb676186cab309c7e28b94979f118
@@ -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,41 +22,71 @@ 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
- @title_context_name ||= "Message: #{message_type}"
33
+ if @title_context_name.nil?
34
+ @title_context_name = "Message"
35
+
36
+ if not message.nil?
37
+ @title_context_name = "#{@title_context_name}: #{message_type}"
38
+ end
39
+ end
40
+
41
+ @title_context_name
27
42
  end
28
43
 
29
- 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
30
50
 
31
- def self.build(message, source_message=nil, title_context_name: nil, &test_block)
32
- 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)
33
55
  end
34
56
 
35
57
  def call
36
- context_name = title_context_name
37
-
38
- context context_name do
39
- if test_block.nil?
40
- raise Error, "Message fixture must be executed with a block"
58
+ if print_title_context?
59
+ context "#{title_context_name}" do
60
+ call!
41
61
  end
62
+ else
63
+ call!
64
+ end
65
+ end
42
66
 
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
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?)
50
77
  end
78
+ return
79
+ end
51
80
 
81
+ if detail_message_class?
52
82
  detail "Message Class: #{message_class.name}"
83
+ end
53
84
 
54
- if not source_message.nil?
55
- detail "Source Message Class: #{source_message_class.name}"
56
- end
57
-
58
- test_block.call(self)
85
+ if not source_message.nil?
86
+ detail "Source Message Class: #{source_message_class.name}"
59
87
  end
88
+
89
+ test_block.call(self)
60
90
  end
61
91
 
62
92
  def assert_attributes_assigned(attribute_names=nil)
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.1
4
+ version: 1.1.5.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-25 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
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
96
  requirements: []
97
- rubygems_version: 3.1.2
97
+ rubygems_version: 3.1.4
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: TestBench fixtures for the Messaging library