synapse-core 0.4.0 → 0.5.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.
Files changed (163) hide show
  1. data/lib/synapse/command/async_command_bus.rb +41 -0
  2. data/lib/synapse/command/command_callback.rb +49 -2
  3. data/lib/synapse/command/command_handler.rb +2 -0
  4. data/lib/synapse/command/filters/validation.rb +2 -2
  5. data/lib/synapse/command/gateway/interval_retry_scheduler.rb +75 -0
  6. data/lib/synapse/command/gateway/retry_scheduler.rb +26 -0
  7. data/lib/synapse/command/gateway/retrying_callback.rb +46 -0
  8. data/lib/synapse/command/gateway.rb +56 -11
  9. data/lib/synapse/command/interceptor_chain.rb +2 -2
  10. data/lib/synapse/command/interceptors/serialization.rb +2 -2
  11. data/lib/synapse/command/message.rb +16 -0
  12. data/lib/synapse/command/simple_command_bus.rb +6 -2
  13. data/lib/synapse/command/wiring.rb +3 -3
  14. data/lib/synapse/command.rb +7 -1
  15. data/lib/synapse/common/concurrency/identifier_lock.rb +2 -17
  16. data/lib/synapse/common/concurrency/public_lock.rb +8 -9
  17. data/lib/synapse/common/errors.rb +1 -1
  18. data/lib/synapse/common/message.rb +2 -6
  19. data/lib/synapse/common.rb +9 -0
  20. data/lib/synapse/configuration/component/command_bus/async_command_bus.rb +41 -0
  21. data/lib/synapse/configuration/component/command_bus/gateway.rb +38 -0
  22. data/lib/synapse/configuration/component/command_bus/simple_command_bus.rb +81 -0
  23. data/lib/synapse/configuration/component/command_bus.rb +35 -0
  24. data/lib/synapse/configuration/component/event_bus/simple_event_bus.rb +41 -0
  25. data/lib/synapse/configuration/component/event_bus.rb +15 -0
  26. data/lib/synapse/configuration/component/event_sourcing/repository.rb +62 -0
  27. data/lib/synapse/configuration/component/event_sourcing.rb +15 -0
  28. data/lib/synapse/configuration/component/repository/locking_repository.rb +85 -0
  29. data/lib/synapse/configuration/component/repository/simple_repository.rb +31 -0
  30. data/lib/synapse/configuration/component/repository.rb +15 -0
  31. data/lib/synapse/configuration/component/serialization/converter_factory.rb +50 -0
  32. data/lib/synapse/configuration/component/serialization/serializer.rb +90 -0
  33. data/lib/synapse/configuration/component/serialization.rb +25 -0
  34. data/lib/synapse/configuration/component/uow/unit_factory.rb +51 -0
  35. data/lib/synapse/configuration/component/uow.rb +22 -0
  36. data/lib/synapse/configuration/component/upcasting/upcaster_chain.rb +61 -0
  37. data/lib/synapse/configuration/component/upcasting.rb +15 -0
  38. data/lib/synapse/configuration/container.rb +80 -0
  39. data/lib/synapse/configuration/container_builder.rb +108 -0
  40. data/lib/synapse/configuration/definition.rb +31 -0
  41. data/lib/synapse/configuration/definition_builder.rb +138 -0
  42. data/lib/synapse/configuration/dependent.rb +31 -0
  43. data/lib/synapse/configuration/ext.rb +35 -0
  44. data/lib/synapse/configuration.rb +32 -0
  45. data/lib/synapse/domain/aggregate_root.rb +25 -26
  46. data/lib/synapse/domain/event_container.rb +5 -5
  47. data/lib/synapse/domain/message.rb +16 -0
  48. data/lib/synapse/event_bus/event_listener.rb +2 -0
  49. data/lib/synapse/event_bus/event_publisher.rb +19 -0
  50. data/lib/synapse/event_bus/simple_event_bus.rb +21 -30
  51. data/lib/synapse/event_bus/wiring.rb +5 -4
  52. data/lib/synapse/event_bus.rb +1 -1
  53. data/lib/synapse/event_sourcing/aggregate_root.rb +6 -4
  54. data/lib/synapse/process_manager/container_resource_injector.rb +18 -0
  55. data/lib/synapse/process_manager/pessimistic_lock_manager.rb +1 -1
  56. data/lib/synapse/process_manager/process.rb +4 -0
  57. data/lib/synapse/process_manager/process_factory.rb +3 -3
  58. data/lib/synapse/process_manager/repository/in_memory.rb +1 -1
  59. data/lib/synapse/process_manager/wiring/process.rb +6 -6
  60. data/lib/synapse/process_manager/wiring/process_manager.rb +8 -8
  61. data/lib/synapse/process_manager.rb +2 -0
  62. data/lib/synapse/repository/locking.rb +5 -3
  63. data/lib/synapse/repository/optimistic_lock_manager.rb +2 -7
  64. data/lib/synapse/repository/pessimistic_lock_manager.rb +3 -3
  65. data/lib/synapse/repository/repository.rb +2 -2
  66. data/lib/synapse/repository/simple_repository.rb +69 -0
  67. data/lib/synapse/repository.rb +1 -0
  68. data/lib/synapse/serialization/converter/chain.rb +2 -2
  69. data/lib/synapse/serialization/converter_factory.rb +2 -2
  70. data/lib/synapse/serialization/lazy_object.rb +2 -2
  71. data/lib/synapse/serialization/message/serialization_aware_message.rb +3 -3
  72. data/lib/synapse/serialization/message/serialized_message.rb +6 -10
  73. data/lib/synapse/serialization/message/serialized_message_builder.rb +4 -4
  74. data/lib/synapse/serialization/message/serialized_object_cache.rb +2 -2
  75. data/lib/synapse/serialization/message/serializer.rb +2 -2
  76. data/lib/synapse/serialization/revision_resolver.rb +3 -3
  77. data/lib/synapse/serialization/serialized_object.rb +2 -2
  78. data/lib/synapse/serialization/serialized_type.rb +2 -2
  79. data/lib/synapse/serialization/serializer/attribute.rb +2 -2
  80. data/lib/synapse/serialization/serializer/marshal.rb +2 -2
  81. data/lib/synapse/serialization/serializer/oj.rb +2 -2
  82. data/lib/synapse/serialization/serializer/ox.rb +2 -2
  83. data/lib/synapse/serialization/serializer.rb +2 -2
  84. data/lib/synapse/uow/factory.rb +2 -2
  85. data/lib/synapse/uow/listener_collection.rb +2 -2
  86. data/lib/synapse/uow/nesting.rb +9 -2
  87. data/lib/synapse/uow/provider.rb +2 -2
  88. data/lib/synapse/uow/uow.rb +8 -2
  89. data/lib/synapse/upcasting/{chain.rb → upcaster_chain.rb} +0 -0
  90. data/lib/synapse/upcasting.rb +1 -1
  91. data/lib/synapse/version.rb +1 -1
  92. data/lib/synapse/wiring/message_wiring.rb +31 -0
  93. data/lib/synapse.rb +2 -14
  94. data/test/auditing/data_provider_test.rb +2 -2
  95. data/test/auditing/dispatch_interceptor_test.rb +1 -1
  96. data/test/auditing/unit_listener_test.rb +3 -3
  97. data/test/command/async_command_bus_test.rb +49 -0
  98. data/test/command/duplication_test.rb +2 -2
  99. data/test/command/gateway/interval_retry_scheduler_test.rb +42 -0
  100. data/test/command/gateway/retrying_callback_test.rb +57 -0
  101. data/test/command/gateway_test.rb +41 -7
  102. data/test/command/interceptor_chain_test.rb +1 -1
  103. data/test/command/message_test.rb +17 -0
  104. data/test/command/serialization_test.rb +2 -2
  105. data/test/command/simple_command_bus_test.rb +7 -7
  106. data/test/command/validation_test.rb +3 -3
  107. data/test/command/wiring_test.rb +3 -3
  108. data/test/common/concurrency/identifier_lock_test.rb +2 -13
  109. data/test/common/concurrency/public_lock_test.rb +6 -6
  110. data/test/{duplication_test.rb → common/duplication_test.rb} +3 -3
  111. data/test/configuration/component/command_bus/async_command_bus_test.rb +36 -0
  112. data/test/configuration/component/command_bus/simple_command_bus_test.rb +57 -0
  113. data/test/configuration/component/event_bus/simple_event_bus_test.rb +58 -0
  114. data/test/configuration/component/serialization/converter_factory_test.rb +48 -0
  115. data/test/configuration/component/serialization/serializer_test.rb +78 -0
  116. data/test/configuration/component/uow/unit_factory_test.rb +46 -0
  117. data/test/configuration/container_builder_test.rb +47 -0
  118. data/test/configuration/container_test.rb +88 -0
  119. data/test/configuration/definition_builder_test.rb +126 -0
  120. data/test/configuration/definition_test.rb +41 -0
  121. data/test/configuration/dependent_test.rb +30 -0
  122. data/test/configuration/ext_test.rb +19 -0
  123. data/test/configuration/fixtures/dependent.rb +10 -0
  124. data/test/domain/aggregate_root_test.rb +5 -5
  125. data/test/domain/message_test.rb +15 -3
  126. data/test/domain/stream_test.rb +2 -2
  127. data/test/event_bus/publisher_test.rb +29 -0
  128. data/test/event_bus/wiring_test.rb +1 -1
  129. data/test/event_sourcing/aggregate_factory_test.rb +12 -6
  130. data/test/event_sourcing/aggregate_root_test.rb +4 -4
  131. data/test/event_sourcing/entity_test.rb +10 -9
  132. data/test/event_sourcing/repository_test.rb +6 -6
  133. data/test/event_sourcing/storage_listener_test.rb +8 -4
  134. data/test/event_store/in_memory_test.rb +3 -3
  135. data/test/process_manager/container_resource_injector_test.rb +19 -0
  136. data/test/process_manager/correlation_set_test.rb +2 -2
  137. data/test/process_manager/correlation_test.rb +2 -2
  138. data/test/process_manager/in_memory_test.rb +3 -3
  139. data/test/process_manager/process_factory_test.rb +2 -2
  140. data/test/process_manager/process_test.rb +3 -3
  141. data/test/process_manager/simple_process_manager_test.rb +5 -5
  142. data/test/process_manager/wiring/process_manager_test.rb +4 -4
  143. data/test/process_manager/wiring/process_test.rb +2 -2
  144. data/test/repository/locking_test.rb +4 -4
  145. data/test/repository/optimistic_test.rb +2 -2
  146. data/test/repository/pessimistic_test.rb +1 -1
  147. data/test/repository/simple_repository_test.rb +79 -0
  148. data/test/support/countdown_latch.rb +18 -0
  149. data/test/test_helper.rb +6 -3
  150. data/test/upcasting/data_test.rb +31 -0
  151. metadata +84 -25
  152. data/lib/synapse/event_bus/event_listener_proxy.rb +0 -12
  153. data/lib/synapse/partitioning/memory_queue_reader.rb +0 -31
  154. data/lib/synapse/partitioning/memory_queue_writer.rb +0 -19
  155. data/lib/synapse/partitioning/message_receipt.rb +0 -25
  156. data/lib/synapse/partitioning/packing/json_packer.rb +0 -93
  157. data/lib/synapse/partitioning/packing/json_unpacker.rb +0 -83
  158. data/lib/synapse/partitioning/packing.rb +0 -27
  159. data/lib/synapse/partitioning/queue_reader.rb +0 -32
  160. data/lib/synapse/partitioning/queue_writer.rb +0 -17
  161. data/lib/synapse/partitioning.rb +0 -18
  162. data/test/partitioning/memory_test.rb +0 -34
  163. data/test/partitioning/packing/json_test.rb +0 -62
@@ -4,7 +4,7 @@ module Synapse
4
4
  module ProcessManager
5
5
 
6
6
  class InMemoryProcessRepositoryTest < Test::Unit::TestCase
7
- def test_find
7
+ should 'support finding processes by correlations' do
8
8
  correlation_a = Correlation.new :order_id, 1
9
9
  correlation_b = Correlation.new :order_id, 2
10
10
 
@@ -21,7 +21,7 @@ module Synapse
21
21
  assert_equal [process_b.id], repository.find(Process, correlation_b)
22
22
  end
23
23
 
24
- def test_load
24
+ should 'support loading processes by identifier' do
25
25
  repository = InMemoryProcessRepository.new
26
26
 
27
27
  process_a = Process.new
@@ -34,7 +34,7 @@ module Synapse
34
34
  assert_equal process_b, repository.load(process_b.id)
35
35
  end
36
36
 
37
- def test_commit
37
+ should 'mark processes as committed' do
38
38
  repository = InMemoryProcessRepository.new
39
39
 
40
40
  process = Process.new
@@ -3,7 +3,7 @@ require 'test_helper'
3
3
  module Synapse
4
4
  module ProcessManager
5
5
  class GenericProcessFactoryTest < Test::Unit::TestCase
6
- def test_create
6
+ should 'be able to create processes' do
7
7
  injector = Object.new
8
8
 
9
9
  mock(injector).inject_resources(is_a(Process))
@@ -16,7 +16,7 @@ module Synapse
16
16
  assert process.is_a? Process
17
17
  end
18
18
 
19
- def test_supports
19
+ should 'be able to determine if a process implementation is supported' do
20
20
  factory = GenericProcessFactory.new
21
21
 
22
22
  assert factory.supports Process
@@ -4,7 +4,7 @@ module Synapse
4
4
  module ProcessManager
5
5
 
6
6
  class ProcessTest < Test::Unit::TestCase
7
- def test_initialize
7
+ should 'initialize with sensible defaults' do
8
8
  process = StubProcess.new
9
9
  correlation = Correlation.new :process_id, process.id
10
10
 
@@ -14,7 +14,7 @@ module Synapse
14
14
  assert process.active?
15
15
  end
16
16
 
17
- def test_dissociate_from
17
+ should 'support deletion of a correlation' do
18
18
  process = StubProcess.new
19
19
 
20
20
  key = :order_id
@@ -27,7 +27,7 @@ module Synapse
27
27
  refute process.correlations.include? Correlation.new(key, value)
28
28
  end
29
29
 
30
- def test_finish
30
+ should 'be able to be marked as finished' do
31
31
  process = StubProcess.new
32
32
  process.cause_finish
33
33
 
@@ -11,7 +11,7 @@ module Synapse
11
11
  @manager = SimpleProcessManager.new @repository, @factory, @lock_manager, @resolver, TestProcess
12
12
  end
13
13
 
14
- def test_notify_new_process
14
+ should 'create a new process and notify it if one could not be found' do
15
15
  @manager.optionally_create_events << CauseProcessCreationEvent
16
16
 
17
17
  correlation = Correlation.new :order_id, 123
@@ -24,7 +24,7 @@ module Synapse
24
24
  assert_equal 1, @repository.count
25
25
  end
26
26
 
27
- def test_notify_existing_process
27
+ should 'load and notify an existing process correlated with an event' do
28
28
  process = TestProcess.new
29
29
  process.correlations.add Correlation.new :order_id, 123
30
30
 
@@ -38,7 +38,7 @@ module Synapse
38
38
  assert_equal 1, @repository.count
39
39
  end
40
40
 
41
- def test_notify_process_raises_but_suppressed
41
+ should 'suppress exceptions raised by a process while handling an event' do
42
42
  process = TestProcess.new
43
43
  process.correlations.add Correlation.new :order_id, 123
44
44
 
@@ -52,7 +52,7 @@ module Synapse
52
52
  assert_equal 1, @repository.count
53
53
  end
54
54
 
55
- def test_notify_process_raises
55
+ should 'release its lock before raising an exception caused by a process' do
56
56
  process = TestProcess.new
57
57
  process.correlations.add Correlation.new :order_id, 123
58
58
 
@@ -68,7 +68,7 @@ module Synapse
68
68
  end
69
69
  end
70
70
 
71
- def test_always_create
71
+ should 'always create a process if specified by the creation policy' do
72
72
  @manager.always_create_events << CauseProcessCreationEvent
73
73
 
74
74
  correlation = Correlation.new :order_id, 123
@@ -13,13 +13,13 @@ module Synapse
13
13
  @manager = WiringProcessManager.new @repository, @factory, @lock_manager, OrderProcess
14
14
  end
15
15
 
16
- def test_support
16
+ should 'raise an exception if used with a process that does not support wiring' do
17
17
  assert_raise ArgumentError do
18
18
  WiringProcessManager.new @repository, @factory, @lock_manager, Process
19
19
  end
20
20
  end
21
21
 
22
- def test_correlation
22
+ should 'use wiring attributes to determine correlation keys' do
23
23
  event = create_event OrderCreated.new 123
24
24
  @manager.notify event
25
25
 
@@ -29,7 +29,7 @@ module Synapse
29
29
  assert_equal 1, processes.count
30
30
  end
31
31
 
32
- def test_creation_policy
32
+ should 'use wiring attributes to determine creation policy' do
33
33
  event = create_event OrderCreated.new 123
34
34
 
35
35
  @manager.notify event
@@ -52,7 +52,7 @@ module Synapse
52
52
  assert_equal 3, @repository.count
53
53
  end
54
54
 
55
- def test_correlation_fails
55
+ should 'raise an exception if the correlation key does not exist on the event' do
56
56
  event = create_event OrderDerped.new
57
57
 
58
58
  assert_raise RuntimeError do
@@ -9,7 +9,7 @@ module Synapse
9
9
  @process = OrderProcess.new
10
10
  end
11
11
 
12
- def test_handle
12
+ should 'use the correct handler when notified of an event' do
13
13
  event = Domain::EventMessage.build do |builder|
14
14
  builder.payload = OrderCreated.new 123
15
15
  end
@@ -19,7 +19,7 @@ module Synapse
19
19
  assert_equal 1, @process.handled
20
20
  end
21
21
 
22
- def test_handle_finish
22
+ should 'use wiring attributes to determine when to mark itself as finished' do
23
23
  event = Domain::EventMessage.build do |builder|
24
24
  builder.payload = OrderCanceled.new 123
25
25
  end
@@ -19,7 +19,7 @@ module Synapse
19
19
  @repository.unit_provider = @unit_provider
20
20
  end
21
21
 
22
- def test_add
22
+ should 'handling locking when an aggregate is added' do
23
23
  mock(@lock_manager).obtain_lock(123)
24
24
  mock(@lock_manager).release_lock(123)
25
25
 
@@ -31,7 +31,7 @@ module Synapse
31
31
  @unit.commit
32
32
  end
33
33
 
34
- def test_add_incompatible_aggregate
34
+ should 'raise an exception if an incompatible aggregate is added' do
35
35
  mock(@lock_manager).obtain_lock(123)
36
36
  mock(@lock_manager).release_lock(123)
37
37
 
@@ -43,7 +43,7 @@ module Synapse
43
43
  end
44
44
  end
45
45
 
46
- def test_add_versioned
46
+ should 'raise an exception if an aggregate is added that already has a version' do
47
47
  mock(@lock_manager).obtain_lock(123)
48
48
  mock(@lock_manager).release_lock(123)
49
49
 
@@ -54,7 +54,7 @@ module Synapse
54
54
  end
55
55
  end
56
56
 
57
- def test_load_version_ahead
57
+ should 'raise an exception if a loaded aggregate has an unexpected version' do
58
58
  mock(@lock_manager).obtain_lock(123)
59
59
  mock(@lock_manager).release_lock(123)
60
60
 
@@ -4,7 +4,7 @@ require 'domain/fixtures'
4
4
  module Synapse
5
5
  module Repository
6
6
  class OptimisticLockManagerTest < Test::Unit::TestCase
7
- def test_fails_on_concurrent_modification
7
+ should 'fail to validate on concurrent modification' do
8
8
  manager = OptimisticLockManager.new
9
9
 
10
10
  id = SecureRandom.uuid
@@ -23,7 +23,7 @@ module Synapse
23
23
  refute manager.validate_lock aggregate2
24
24
  end
25
25
 
26
- def test_lock_cleanup
26
+ should 'cleanup unused locks' do
27
27
  manager = OptimisticLockManager.new
28
28
 
29
29
  id = SecureRandom.uuid
@@ -4,7 +4,7 @@ require 'domain/fixtures'
4
4
  module Synapse
5
5
  module Repository
6
6
  class PessimisticLockManagerTest < Test::Unit::TestCase
7
- def test_lifecycle
7
+ should 'support obtaining and releasing a lock for an aggregate' do
8
8
  @manager = PessimisticLockManager.new
9
9
 
10
10
  aggregate = Domain::Person.new SecureRandom.uuid, 'Bender'
@@ -0,0 +1,79 @@
1
+ require 'test_helper'
2
+
3
+ module Synapse
4
+ module Repository
5
+ class SimpleRepositoryTest < Test::Unit::TestCase
6
+ def setup
7
+ @unit_provider = UnitOfWork::UnitOfWorkProvider.new
8
+ @unit_factory = UnitOfWork::UnitOfWorkFactory.new @unit_provider
9
+
10
+ @repository = SimpleRepository.new NullLockManager.new, TestMappedAggregate
11
+ @repository.event_bus = EventBus::SimpleEventBus.new
12
+ @repository.unit_provider = @unit_provider
13
+ end
14
+
15
+ should 'load an aggregate using its finder' do
16
+ unit = @unit_factory.create
17
+
18
+ aggregate = TestMappedAggregate.new '5677b4f7'
19
+ mock(TestMappedAggregate).find(aggregate.id) do
20
+ aggregate
21
+ end
22
+
23
+ loaded = @repository.load aggregate.id
24
+
25
+ assert_same loaded, aggregate
26
+ end
27
+
28
+ should 'raise an exception if the aggregate could not be found' do
29
+ mock(TestMappedAggregate).find('5677b4f7')
30
+
31
+ assert_raise AggregateNotFoundError do
32
+ @repository.load '5677b4f7'
33
+ end
34
+ end
35
+
36
+ should 'raise an exception if the loaded aggregate has an unexpected version' do
37
+ unit = @unit_factory.create
38
+
39
+ aggregate = TestMappedAggregate.new '5677b4f7'
40
+ aggregate.version = 5
41
+
42
+ mock(TestMappedAggregate).find(aggregate.id) do
43
+ aggregate
44
+ end
45
+
46
+ assert_raise ConflictingAggregateVersionError do
47
+ @repository.load aggregate.id, 4
48
+ end
49
+ end
50
+
51
+ should 'delete the aggregate if it has been marked for deletion' do
52
+ unit = @unit_factory.create
53
+
54
+ aggregate = TestMappedAggregate.new '5677b4f7'
55
+ aggregate.delete_this_thing
56
+
57
+ @repository.add aggregate
58
+
59
+ mock(aggregate).destroy
60
+
61
+ unit.commit
62
+ end
63
+ end
64
+
65
+ class TestMappedAggregate
66
+ include Domain::AggregateRoot
67
+
68
+ attr_accessor :version
69
+
70
+ def initialize(id)
71
+ @id = id
72
+ end
73
+
74
+ def delete_this_thing
75
+ mark_deleted
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,18 @@
1
+ class CountdownLatch
2
+ def initialize(count)
3
+ @count = count
4
+ @mutex = Mutex.new
5
+ end
6
+
7
+ def countdown!
8
+ @mutex.synchronize do
9
+ @count = @count.pred if @count > 0
10
+ end
11
+ end
12
+
13
+ def count
14
+ @mutex.synchronize do
15
+ @count
16
+ end
17
+ end
18
+ end
data/test/test_helper.rb CHANGED
@@ -9,15 +9,18 @@ else
9
9
  end
10
10
 
11
11
  require 'pp'
12
+ require 'synapse'
12
13
  require 'test/unit'
14
+ require 'shoulda/context'
13
15
  require 'rr'
14
16
  require 'timecop'
15
- require 'synapse'
16
17
 
17
18
  require 'test_ext'
18
19
 
19
- class Test::Unit::TestCase
20
- include RR::Adapters::TestUnit
20
+ # I guess RR broke
21
+ # http://stackoverflow.com/questions/3657972
22
+ unless defined? Test::Unit::AssertionFailedError
23
+ Test::Unit::AssertionFailedError = ActiveSupport::TestCase::Assertion
21
24
  end
22
25
 
23
26
  ActiveSupport::Autoload.eager_autoload!
@@ -0,0 +1,31 @@
1
+ require 'test_helper'
2
+ require 'ostruct'
3
+
4
+ module Synapse
5
+ module Upcasting
6
+ class UpcastSerializedDomainEventDataTest < Test::Unit::TestCase
7
+ def test_delegation
8
+ delegate = OpenStruct.new
9
+ delegate.id = SecureRandom.uuid
10
+ delegate.metadata = Object.new
11
+ delegate.payload = Object.new
12
+ delegate.timestamp = Time.now
13
+ delegate.aggregate_id = Object.new
14
+ delegate.sequence_number = 123
15
+
16
+ aggregate_id = Object.new
17
+ upcast_payload = Object.new
18
+
19
+ upcast = UpcastSerializedDomainEventData.new delegate, aggregate_id, upcast_payload
20
+
21
+ # Assert delegated properties
22
+ assert_same delegate.id, upcast.id
23
+ assert_same delegate.metadata, upcast.metadata
24
+ assert_same upcast_payload, upcast.payload
25
+ assert_same delegate.timestamp, upcast.timestamp
26
+ assert_same aggregate_id, upcast.aggregate_id
27
+ assert_same delegate.sequence_number, upcast.sequence_number
28
+ end
29
+ end
30
+ end
31
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synapse-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,42 +9,58 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-14 00:00:00.000000000 Z
12
+ date: 2013-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: '3.2'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: '3.2'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: atomic
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - ! '>='
35
+ - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: '0'
37
+ version: '1.1'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ! '>='
43
+ - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: '0'
45
+ version: '1.1'
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: logging
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.8'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.8'
62
+ - !ruby/object:Gem::Dependency
63
+ name: thread
48
64
  requirement: !ruby/object:Gem::Requirement
49
65
  none: false
50
66
  requirements:
@@ -76,9 +92,13 @@ files:
76
92
  - lib/synapse/uow/nesting.rb
77
93
  - lib/synapse/command/rollback_policy.rb
78
94
  - lib/synapse/command/interceptors/serialization.rb
95
+ - lib/synapse/command/gateway/interval_retry_scheduler.rb
96
+ - lib/synapse/command/gateway/retrying_callback.rb
97
+ - lib/synapse/command/gateway/retry_scheduler.rb
79
98
  - lib/synapse/command/duplication.rb
80
99
  - lib/synapse/command/simple_command_bus.rb
81
100
  - lib/synapse/command/message.rb
101
+ - lib/synapse/command/async_command_bus.rb
82
102
  - lib/synapse/command/interceptor_chain.rb
83
103
  - lib/synapse/command/wiring.rb
84
104
  - lib/synapse/command/command_filter.rb
@@ -92,6 +112,7 @@ files:
92
112
  - lib/synapse/event_store.rb
93
113
  - lib/synapse/repository/lock_manager.rb
94
114
  - lib/synapse/repository/pessimistic_lock_manager.rb
115
+ - lib/synapse/repository/simple_repository.rb
95
116
  - lib/synapse/repository/optimistic_lock_manager.rb
96
117
  - lib/synapse/repository/errors.rb
97
118
  - lib/synapse/repository/locking.rb
@@ -109,12 +130,36 @@ files:
109
130
  - lib/synapse/event_sourcing/aggregate_root.rb
110
131
  - lib/synapse/event_sourcing/conflict_resolver.rb
111
132
  - lib/synapse/upcasting/upcaster.rb
112
- - lib/synapse/upcasting/chain.rb
133
+ - lib/synapse/upcasting/upcaster_chain.rb
113
134
  - lib/synapse/upcasting/data.rb
114
135
  - lib/synapse/upcasting/single_upcaster.rb
115
136
  - lib/synapse/upcasting/context.rb
116
137
  - lib/synapse/version.rb
117
138
  - lib/synapse/process_manager.rb
139
+ - lib/synapse/configuration/definition_builder.rb
140
+ - lib/synapse/configuration/ext.rb
141
+ - lib/synapse/configuration/container_builder.rb
142
+ - lib/synapse/configuration/dependent.rb
143
+ - lib/synapse/configuration/definition.rb
144
+ - lib/synapse/configuration/component/uow/unit_factory.rb
145
+ - lib/synapse/configuration/component/command_bus/simple_command_bus.rb
146
+ - lib/synapse/configuration/component/command_bus/async_command_bus.rb
147
+ - lib/synapse/configuration/component/command_bus/gateway.rb
148
+ - lib/synapse/configuration/component/repository/simple_repository.rb
149
+ - lib/synapse/configuration/component/repository/locking_repository.rb
150
+ - lib/synapse/configuration/component/event_sourcing/repository.rb
151
+ - lib/synapse/configuration/component/upcasting/upcaster_chain.rb
152
+ - lib/synapse/configuration/component/upcasting.rb
153
+ - lib/synapse/configuration/component/serialization.rb
154
+ - lib/synapse/configuration/component/uow.rb
155
+ - lib/synapse/configuration/component/repository.rb
156
+ - lib/synapse/configuration/component/event_bus/simple_event_bus.rb
157
+ - lib/synapse/configuration/component/serialization/converter_factory.rb
158
+ - lib/synapse/configuration/component/serialization/serializer.rb
159
+ - lib/synapse/configuration/component/event_sourcing.rb
160
+ - lib/synapse/configuration/component/event_bus.rb
161
+ - lib/synapse/configuration/component/command_bus.rb
162
+ - lib/synapse/configuration/container.rb
118
163
  - lib/synapse/process_manager/process_repository.rb
119
164
  - lib/synapse/process_manager/lock_manager.rb
120
165
  - lib/synapse/process_manager/correlation_set.rb
@@ -126,15 +171,18 @@ files:
126
171
  - lib/synapse/process_manager/process_factory.rb
127
172
  - lib/synapse/process_manager/resource_injector.rb
128
173
  - lib/synapse/process_manager/simple_process_manager.rb
174
+ - lib/synapse/process_manager/container_resource_injector.rb
129
175
  - lib/synapse/process_manager/wiring/process_manager.rb
130
176
  - lib/synapse/process_manager/wiring/process.rb
131
177
  - lib/synapse/process_manager/process.rb
132
178
  - lib/synapse/command.rb
179
+ - lib/synapse/common.rb
133
180
  - lib/synapse/upcasting.rb
134
181
  - lib/synapse/event_store/event_store.rb
135
182
  - lib/synapse/event_store/errors.rb
136
183
  - lib/synapse/event_store/in_memory.rb
137
184
  - lib/synapse/wiring.rb
185
+ - lib/synapse/configuration.rb
138
186
  - lib/synapse/auditing/audit_logger.rb
139
187
  - lib/synapse/auditing/data_provider.rb
140
188
  - lib/synapse/auditing/dispatch_interceptor.rb
@@ -152,10 +200,9 @@ files:
152
200
  - lib/synapse/repository.rb
153
201
  - lib/synapse/event_bus/simple_event_bus.rb
154
202
  - lib/synapse/event_bus/wiring.rb
155
- - lib/synapse/event_bus/event_listener_proxy.rb
203
+ - lib/synapse/event_bus/event_publisher.rb
156
204
  - lib/synapse/event_bus/event_listener.rb
157
205
  - lib/synapse/event_bus/event_bus.rb
158
- - lib/synapse/partitioning.rb
159
206
  - lib/synapse/wiring/wire.rb
160
207
  - lib/synapse/wiring/message_wiring.rb
161
208
  - lib/synapse/wiring/wire_registry.rb
@@ -164,14 +211,6 @@ files:
164
211
  - lib/synapse/domain/stream.rb
165
212
  - lib/synapse/domain/message_builder.rb
166
213
  - lib/synapse/domain/aggregate_root.rb
167
- - lib/synapse/partitioning/memory_queue_writer.rb
168
- - lib/synapse/partitioning/packing.rb
169
- - lib/synapse/partitioning/memory_queue_reader.rb
170
- - lib/synapse/partitioning/packing/json_unpacker.rb
171
- - lib/synapse/partitioning/packing/json_packer.rb
172
- - lib/synapse/partitioning/queue_reader.rb
173
- - lib/synapse/partitioning/queue_writer.rb
174
- - lib/synapse/partitioning/message_receipt.rb
175
214
  - lib/synapse/serialization/lazy_object.rb
176
215
  - lib/synapse/serialization/revision_resolver.rb
177
216
  - lib/synapse/serialization/message/serialization_aware.rb
@@ -198,7 +237,6 @@ files:
198
237
  - lib/synapse/serialization/serialized_object.rb
199
238
  - lib/synapse/event_sourcing.rb
200
239
  - lib/synapse/event_bus.rb
201
- - test/duplication_test.rb
202
240
  - test/uow/factory_test.rb
203
241
  - test/uow/uow_test.rb
204
242
  - test/uow/outer_commit_listener_test.rb
@@ -206,11 +244,16 @@ files:
206
244
  - test/test_ext.rb
207
245
  - test/command/duplication_test.rb
208
246
  - test/command/interceptor_chain_test.rb
247
+ - test/command/message_test.rb
248
+ - test/command/gateway/retrying_callback_test.rb
249
+ - test/command/gateway/interval_retry_scheduler_test.rb
209
250
  - test/command/gateway_test.rb
210
251
  - test/command/wiring_test.rb
211
252
  - test/command/simple_command_bus_test.rb
253
+ - test/command/async_command_bus_test.rb
212
254
  - test/command/serialization_test.rb
213
255
  - test/command/validation_test.rb
256
+ - test/repository/simple_repository_test.rb
214
257
  - test/repository/pessimistic_test.rb
215
258
  - test/repository/optimistic_test.rb
216
259
  - test/repository/locking_test.rb
@@ -223,10 +266,25 @@ files:
223
266
  - test/event_sourcing/entity_test.rb
224
267
  - test/event_sourcing/fixtures.rb
225
268
  - test/event_sourcing/aggregate_factory_test.rb
269
+ - test/upcasting/data_test.rb
226
270
  - test/upcasting/fixtures.rb
227
271
  - test/upcasting/chain_test.rb
272
+ - test/configuration/container_builder_test.rb
273
+ - test/configuration/definition_builder_test.rb
274
+ - test/configuration/definition_test.rb
275
+ - test/configuration/container_test.rb
276
+ - test/configuration/dependent_test.rb
277
+ - test/configuration/fixtures/dependent.rb
278
+ - test/configuration/ext_test.rb
279
+ - test/configuration/component/uow/unit_factory_test.rb
280
+ - test/configuration/component/command_bus/simple_command_bus_test.rb
281
+ - test/configuration/component/command_bus/async_command_bus_test.rb
282
+ - test/configuration/component/event_bus/simple_event_bus_test.rb
283
+ - test/configuration/component/serialization/serializer_test.rb
284
+ - test/configuration/component/serialization/converter_factory_test.rb
228
285
  - test/process_manager/process_test.rb
229
286
  - test/process_manager/correlation_set_test.rb
287
+ - test/process_manager/container_resource_injector_test.rb
230
288
  - test/process_manager/simple_process_manager_test.rb
231
289
  - test/process_manager/correlation_test.rb
232
290
  - test/process_manager/process_factory_test.rb
@@ -238,8 +296,11 @@ files:
238
296
  - test/auditing/dispatch_interceptor_test.rb
239
297
  - test/auditing/data_provider_test.rb
240
298
  - test/auditing/unit_listener_test.rb
299
+ - test/support/countdown_latch.rb
300
+ - test/common/duplication_test.rb
241
301
  - test/common/concurrency/identifier_lock_test.rb
242
302
  - test/common/concurrency/public_lock_test.rb
303
+ - test/event_bus/publisher_test.rb
243
304
  - test/event_bus/wiring_test.rb
244
305
  - test/wiring/wire_registry_test.rb
245
306
  - test/wiring/wire_test.rb
@@ -247,8 +308,6 @@ files:
247
308
  - test/domain/aggregate_root_test.rb
248
309
  - test/domain/message_test.rb
249
310
  - test/domain/fixtures.rb
250
- - test/partitioning/packing/json_test.rb
251
- - test/partitioning/memory_test.rb
252
311
  - test/serialization/message/metadata_test.rb
253
312
  - test/serialization/message/serialization_aware_message_test.rb
254
313
  - test/serialization/message/serializer_test.rb
@@ -268,7 +327,7 @@ files:
268
327
  - test/serialization/revision_resolver_test.rb
269
328
  - test/serialization/fixtures.rb
270
329
  - test/serialization/serialized_type_test.rb
271
- homepage: https://github.com/iunruh/synapse
330
+ homepage: https://github.com/ianunruh/synapse
272
331
  licenses:
273
332
  - Apache 2.0
274
333
  post_install_message:
@@ -1,12 +0,0 @@
1
- module Synapse
2
- module EventBus
3
- # @abstract
4
- module EventListenerProxy
5
- extend EventListener
6
-
7
- # @abstract
8
- # @return [Class]
9
- def target_type; end
10
- end
11
- end
12
- end