synapse-core 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/synapse.rb +1 -1
- data/lib/synapse/command.rb +1 -1
- data/lib/synapse/command/command_handler.rb +1 -1
- data/lib/synapse/command/mapping.rb +71 -0
- data/lib/synapse/command/message.rb +0 -16
- data/lib/synapse/command/simple_command_bus.rb +5 -2
- data/lib/synapse/common/message.rb +16 -0
- data/lib/synapse/configuration.rb +1 -18
- data/lib/synapse/configuration/component/command_bus.rb +7 -24
- data/lib/synapse/configuration/component/command_bus/simple_command_bus.rb +31 -7
- data/lib/synapse/configuration/component/event_bus.rb +3 -8
- data/lib/synapse/configuration/component/event_sourcing.rb +11 -8
- data/lib/synapse/configuration/component/event_sourcing/aggregate_snapshot_taker.rb +48 -0
- data/lib/synapse/configuration/component/event_sourcing/interval_snapshot_policy.rb +33 -0
- data/lib/synapse/configuration/component/event_sourcing/repository.rb +36 -1
- data/lib/synapse/configuration/component/repository.rb +4 -8
- data/lib/synapse/configuration/component/serialization.rb +5 -16
- data/lib/synapse/configuration/component/uow.rb +3 -8
- data/lib/synapse/configuration/component/upcasting.rb +3 -8
- data/lib/synapse/configuration/container_builder.rb +29 -2
- data/lib/synapse/configuration/definition_builder.rb +47 -23
- data/lib/synapse/domain/message.rb +0 -16
- data/lib/synapse/event_bus.rb +1 -1
- data/lib/synapse/event_bus/event_listener.rb +1 -1
- data/lib/synapse/event_bus/mapping.rb +47 -0
- data/lib/synapse/event_sourcing.rb +3 -2
- data/lib/synapse/event_sourcing/aggregate_factory.rb +4 -3
- data/lib/synapse/event_sourcing/aggregate_root.rb +17 -0
- data/lib/synapse/event_sourcing/conflict_resolver.rb +3 -0
- data/lib/synapse/event_sourcing/member.rb +34 -6
- data/lib/synapse/event_sourcing/repository.rb +17 -0
- data/lib/synapse/event_sourcing/snapshot/aggregate_taker.rb +38 -0
- data/lib/synapse/event_sourcing/snapshot/policy.rb +27 -0
- data/lib/synapse/event_sourcing/snapshot/taker.rb +2 -37
- data/lib/synapse/event_sourcing/snapshot/unit_listener.rb +26 -0
- data/lib/synapse/event_sourcing/stream_decorator.rb +8 -6
- data/lib/synapse/event_store/errors.rb +2 -2
- data/lib/synapse/mapping.rb +2 -0
- data/lib/synapse/mapping/mapper.rb +75 -0
- data/lib/synapse/{wiring/wire.rb → mapping/mapping.rb} +8 -8
- data/lib/synapse/process_manager.rb +2 -2
- data/lib/synapse/process_manager/mapping/process.rb +44 -0
- data/lib/synapse/process_manager/{wiring → mapping}/process_manager.rb +13 -13
- data/lib/synapse/process_manager/process.rb +3 -3
- data/lib/synapse/repository/locking.rb +14 -8
- data/lib/synapse/upcasting/upcaster_chain.rb +2 -2
- data/lib/synapse/version.rb +1 -1
- data/test/command/{wiring_test.rb → mapping_test.rb} +11 -11
- data/test/configuration/component/command_bus/simple_command_bus_test.rb +30 -0
- data/test/configuration/component/event_bus/simple_event_bus_test.rb +2 -2
- data/test/configuration/component/event_sourcing/repository_test.rb +71 -0
- data/test/configuration/component/repository/simple_repository_test.rb +35 -0
- data/test/configuration/component/upcasting/upcaster_chain_test.rb +29 -0
- data/test/configuration/container_builder_test.rb +4 -6
- data/test/event_bus/{wiring_test.rb → mapping_test.rb} +6 -6
- data/test/event_sourcing/aggregate_factory_test.rb +5 -1
- data/test/event_sourcing/aggregate_root_test.rb +1 -0
- data/test/event_sourcing/fixtures.rb +21 -21
- data/test/event_sourcing/repository_test.rb +10 -0
- data/test/event_sourcing/snapshot/aggregate_taker_test.rb +1 -1
- data/test/event_sourcing/snapshot/interval_policy_test.rb +24 -0
- data/test/process_manager/{wiring → mapping}/fixtures.rb +7 -8
- data/test/process_manager/{wiring → mapping}/process_manager_test.rb +6 -6
- data/test/process_manager/{wiring → mapping}/process_test.rb +3 -3
- data/test/serialization/converter/chain_test.rb +2 -2
- data/test/serialization/converter/factory_test.rb +2 -2
- data/test/serialization/converter/identity_test.rb +1 -1
- data/test/serialization/converter/json_test.rb +2 -2
- data/test/serialization/converter/ox_test.rb +2 -2
- data/test/serialization/lazy_object_test.rb +1 -1
- data/test/serialization/message/metadata_test.rb +1 -1
- data/test/serialization/message/serialization_aware_message_test.rb +5 -5
- data/test/serialization/message/serialized_message_builder_test.rb +1 -1
- data/test/serialization/message/serialized_message_test.rb +5 -5
- data/test/serialization/message/serializer_test.rb +2 -2
- data/test/serialization/revision_resolver_test.rb +1 -1
- data/test/serialization/serialized_object_test.rb +2 -2
- data/test/serialization/serialized_type_test.rb +2 -2
- data/test/serialization/serializer/marshal_test.rb +1 -1
- data/test/serialization/serializer/oj_test.rb +1 -1
- data/test/serialization/serializer/ox_test.rb +2 -2
- data/test/serialization/serializer_test.rb +1 -1
- data/test/uow/factory_test.rb +1 -1
- data/test/uow/outer_commit_listener_test.rb +4 -4
- data/test/uow/provider_test.rb +5 -5
- data/test/uow/uow_test.rb +19 -17
- data/test/upcasting/chain_test.rb +1 -1
- data/test/upcasting/data_test.rb +3 -1
- metadata +30 -37
- data/lib/synapse/command/wiring.rb +0 -47
- data/lib/synapse/event_bus/wiring.rb +0 -20
- data/lib/synapse/event_sourcing/snapshot/count_stream.rb +0 -86
- data/lib/synapse/event_sourcing/snapshot/count_trigger.rb +0 -91
- data/lib/synapse/process_manager/wiring/process.rb +0 -27
- data/lib/synapse/wiring.rb +0 -3
- data/lib/synapse/wiring/message_wiring.rb +0 -76
- data/lib/synapse/wiring/wire_registry.rb +0 -61
- data/test/event_sourcing/snapshot/integration_test.rb +0 -65
- data/test/wiring/wire_registry_test.rb +0 -60
- data/test/wiring/wire_test.rb +0 -51
@@ -4,7 +4,7 @@ module Synapse
|
|
4
4
|
module Serialization
|
5
5
|
|
6
6
|
class SerializedDomainEventMessageBuilderTest < Test::Unit::TestCase
|
7
|
-
|
7
|
+
should 'build a message from serialized domain event data' do
|
8
8
|
builder = SerializedDomainEventMessageBuilder.new
|
9
9
|
|
10
10
|
serializer = MarshalSerializer.new ConverterFactory.new
|
@@ -4,7 +4,7 @@ module Synapse
|
|
4
4
|
module Serialization
|
5
5
|
|
6
6
|
class SerializedMessageTest < Test::Unit::TestCase
|
7
|
-
|
7
|
+
should 'provide a builder for serialized messages' do
|
8
8
|
message = SerializedMessage.build do |builder|
|
9
9
|
assert builder.is_a? SerializedMessageBuilder
|
10
10
|
end
|
@@ -13,7 +13,7 @@ module Synapse
|
|
13
13
|
end
|
14
14
|
|
15
15
|
class SerializedEventMessageTest < Test::Unit::TestCase
|
16
|
-
|
16
|
+
should 'provide a builder for serialized event messages' do
|
17
17
|
message = SerializedEventMessage.build do |builder|
|
18
18
|
assert builder.is_a? SerializedEventMessageBuilder
|
19
19
|
end
|
@@ -28,7 +28,7 @@ module Synapse
|
|
28
28
|
@serializer_b = MarshalSerializer.new converter_factory
|
29
29
|
end
|
30
30
|
|
31
|
-
|
31
|
+
should 'lazily deserialize metadata and payload' do
|
32
32
|
metadata = { foo: 0 }
|
33
33
|
payload = { bar: 1 }
|
34
34
|
|
@@ -63,7 +63,7 @@ module Synapse
|
|
63
63
|
assert_equal payload_serialized, payload_serialized_b
|
64
64
|
end
|
65
65
|
|
66
|
-
|
66
|
+
should 'populate fields of message duplicated to add metadata' do
|
67
67
|
metadata = { foo: 0 }
|
68
68
|
payload = { bar: 1 }
|
69
69
|
|
@@ -95,7 +95,7 @@ module Synapse
|
|
95
95
|
assert_message_content_equal message, new_message
|
96
96
|
end
|
97
97
|
|
98
|
-
|
98
|
+
should 'populate fields of message duplicated to replace metadata' do
|
99
99
|
metadata = { foo: 0 }
|
100
100
|
payload = { bar: 1 }
|
101
101
|
|
@@ -3,7 +3,7 @@ require 'test_helper'
|
|
3
3
|
module Synapse
|
4
4
|
module Serialization
|
5
5
|
class MessageSerializerTest < Test::Unit::TestCase
|
6
|
-
|
6
|
+
should 'delegate serialization to serializer if message not serialization aware' do
|
7
7
|
delegate = Object.new
|
8
8
|
serializer = MessageSerializer.new delegate
|
9
9
|
|
@@ -29,7 +29,7 @@ module Synapse
|
|
29
29
|
assert_equal serialized_payload, serializer.serialize_payload(m, String)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
32
|
+
should 'delegate serialization to message if serialization aware' do
|
33
33
|
delegate = Object.new
|
34
34
|
serializer = MessageSerializer.new delegate
|
35
35
|
|
@@ -3,7 +3,7 @@ require 'test_helper'
|
|
3
3
|
module Synapse
|
4
4
|
module Serialization
|
5
5
|
class FixedRevisionResolverTest < Test::Unit::TestCase
|
6
|
-
|
6
|
+
should 'return a fixed revision' do
|
7
7
|
resolver = FixedRevisionResolver.new 1
|
8
8
|
assert_equal '1', resolver.revision_of(Array)
|
9
9
|
end
|
@@ -4,7 +4,7 @@ module Synapse
|
|
4
4
|
module Serialization
|
5
5
|
class SerializedObjectTest < Test::Unit::TestCase
|
6
6
|
|
7
|
-
|
7
|
+
should 'provide initialized fields' do
|
8
8
|
content = 'some content'
|
9
9
|
type = SerializedType.new 'SomeClass', '1'
|
10
10
|
|
@@ -15,7 +15,7 @@ module Synapse
|
|
15
15
|
assert_equal type, object.type
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
should 'support object equality and hashing' do
|
19
19
|
type_a = SerializedType.new 'SomeClass', '1'
|
20
20
|
type_b = SerializedType.new 'SomeClass', '2'
|
21
21
|
|
@@ -4,14 +4,14 @@ module Synapse
|
|
4
4
|
module Serialization
|
5
5
|
class SerializedTypeTest < Test::Unit::TestCase
|
6
6
|
|
7
|
-
|
7
|
+
should 'provide initialized fields' do
|
8
8
|
type = SerializedType.new 'SomeClass', '1'
|
9
9
|
|
10
10
|
assert_equal 'SomeClass', type.name
|
11
11
|
assert_equal '1', type.revision
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
should 'support object equality and hashing' do
|
15
15
|
a = SerializedType.new 'SomeClass', '1'
|
16
16
|
b = SerializedType.new 'SomeClass', '1'
|
17
17
|
c = SerializedType.new 'SomeClass', '2'
|
@@ -6,7 +6,7 @@ module Synapse
|
|
6
6
|
|
7
7
|
class MarshalSerializerTest < Test::Unit::TestCase
|
8
8
|
|
9
|
-
|
9
|
+
should 'support serializing and deserializing content' do
|
10
10
|
serializer = MarshalSerializer.new ConverterFactory.new
|
11
11
|
event = TestEvent.new 'derp', 'herp'
|
12
12
|
|
@@ -9,7 +9,7 @@ module Synapse
|
|
9
9
|
skip 'Oj not supported on JRuby' if defined? JRUBY_VERSION
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
should 'support serializing and deserializing content' do
|
13
13
|
serializer = OjSerializer.new ConverterFactory.new
|
14
14
|
event = TestEvent.new 'derp', 'herp'
|
15
15
|
|
@@ -11,7 +11,7 @@ module Synapse
|
|
11
11
|
@serializer = OxSerializer.new ConverterFactory.new
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
should 'support serializing and deserializing content' do
|
15
15
|
event = TestEvent.new 'derp', 'herp'
|
16
16
|
|
17
17
|
serialized_obj = @serializer.serialize event, String
|
@@ -20,7 +20,7 @@ module Synapse
|
|
20
20
|
assert_equal event, deserialized
|
21
21
|
end
|
22
22
|
|
23
|
-
|
23
|
+
should 'support converting content to/from the native type' do
|
24
24
|
type = SerializedType.new 'String', nil
|
25
25
|
|
26
26
|
assert_equal String, @serializer.class_for(type)
|
data/test/uow/factory_test.rb
CHANGED
@@ -3,7 +3,7 @@ require 'test_helper'
|
|
3
3
|
module Synapse
|
4
4
|
module UnitOfWork
|
5
5
|
class UnitOfWorkFactoryTest < Test::Unit::TestCase
|
6
|
-
|
6
|
+
should 'create a unit of work, set the transaction manager and start it' do
|
7
7
|
provider = UnitOfWorkProvider.new
|
8
8
|
txm = Object.new
|
9
9
|
factory = UnitOfWorkFactory.new provider
|
@@ -10,12 +10,12 @@ module Synapse
|
|
10
10
|
@listener = OuterCommitUnitOfWorkListener.new @inner_unit, @provider
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
should 'commit the inner unit if the outer unit is committed' do
|
14
14
|
mock(@inner_unit).perform_inner_commit
|
15
15
|
@listener.after_commit @outer_unit
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
should 'rollback the inner unit if the outer unit is rolled back' do
|
19
19
|
cause = TestError.new
|
20
20
|
|
21
21
|
mock(@provider).push(@inner_unit)
|
@@ -25,7 +25,7 @@ module Synapse
|
|
25
25
|
@listener.on_rollback @outer_unit, cause
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
should 'ensure the inner unit is rolled back if the outer unit is rolled back' do
|
29
29
|
cause = TestError.new
|
30
30
|
|
31
31
|
mock(@provider).push(@inner_unit)
|
@@ -39,7 +39,7 @@ module Synapse
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
|
42
|
+
should 'cleanup the inner unit if the outer unit is cleaned up' do
|
43
43
|
mock(@inner_unit).perform_cleanup
|
44
44
|
@listener.on_cleanup @outer_unit
|
45
45
|
end
|
data/test/uow/provider_test.rb
CHANGED
@@ -7,7 +7,7 @@ module Synapse
|
|
7
7
|
@provider = UnitOfWorkProvider.new
|
8
8
|
end
|
9
9
|
|
10
|
-
|
10
|
+
should 'clear the current unit of work if it matches the given unit of work' do
|
11
11
|
uow = UnitOfWork.new @provider
|
12
12
|
uow.start
|
13
13
|
|
@@ -16,7 +16,7 @@ module Synapse
|
|
16
16
|
refute @provider.started?
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
should 'raise an exception if the given unit of work to be cleared does not match the current unit of work' do
|
20
20
|
outer = UnitOfWork.new @provider
|
21
21
|
inner = UnitOfWork.new @provider
|
22
22
|
|
@@ -28,7 +28,7 @@ module Synapse
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
|
31
|
+
should 'commit the current unit of work and clear it from the provider' do
|
32
32
|
uow = UnitOfWork.new @provider
|
33
33
|
uow.start
|
34
34
|
|
@@ -38,7 +38,7 @@ module Synapse
|
|
38
38
|
refute uow.started?
|
39
39
|
end
|
40
40
|
|
41
|
-
|
41
|
+
should 'return the current unit of work, if one is in the stack' do
|
42
42
|
uow = UnitOfWork.new @provider
|
43
43
|
|
44
44
|
assert_raises RuntimeError do
|
@@ -50,7 +50,7 @@ module Synapse
|
|
50
50
|
assert_same uow, @provider.current
|
51
51
|
end
|
52
52
|
|
53
|
-
|
53
|
+
should 'keep unit of work stacks separate for each thread' do
|
54
54
|
t1 = Thread.new {
|
55
55
|
uow = UnitOfWork.new @provider
|
56
56
|
uow.start
|
data/test/uow/uow_test.rb
CHANGED
@@ -14,7 +14,7 @@ module Synapse
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
should 'raise an exception if the unit is started twice' do
|
18
18
|
@uow.start
|
19
19
|
|
20
20
|
assert_raises RuntimeError do
|
@@ -24,13 +24,13 @@ module Synapse
|
|
24
24
|
@uow.rollback
|
25
25
|
end
|
26
26
|
|
27
|
-
|
27
|
+
should 'raise an exception if a commit is requested but the unit is not started' do
|
28
28
|
assert_raises RuntimeError do
|
29
29
|
@uow.commit
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
|
33
|
+
should 'keep an identity map for aggregates of the same type and identifier' do
|
34
34
|
aggregate_a = TestAggregateA.new 1
|
35
35
|
aggregate_b = TestAggregateB.new 2
|
36
36
|
aggregate_c = TestAggregateB.new 3
|
@@ -45,7 +45,7 @@ module Synapse
|
|
45
45
|
assert_same aggregate_c, @uow.register_aggregate(aggregate_d, event_bus, storage_listener)
|
46
46
|
end
|
47
47
|
|
48
|
-
|
48
|
+
should 'interact with a transaction manager on commit' do
|
49
49
|
listener = UnitOfWorkListener.new
|
50
50
|
|
51
51
|
tx = Object.new
|
@@ -68,7 +68,7 @@ module Synapse
|
|
68
68
|
@uow.commit
|
69
69
|
end
|
70
70
|
|
71
|
-
|
71
|
+
should 'interact with a transaction manager on rollback' do
|
72
72
|
listener = UnitOfWorkListener.new
|
73
73
|
|
74
74
|
tx = Object.new
|
@@ -89,7 +89,7 @@ module Synapse
|
|
89
89
|
@uow.rollback
|
90
90
|
end
|
91
91
|
|
92
|
-
|
92
|
+
should 'register a listener with the current unit of work if it is unaware of nesting' do
|
93
93
|
outer_unit = Object.new
|
94
94
|
mock(outer_unit).register_listener(is_a(OuterCommitUnitOfWorkListener))
|
95
95
|
mock(outer_unit).rollback
|
@@ -104,7 +104,7 @@ module Synapse
|
|
104
104
|
@provider.clear outer_unit
|
105
105
|
end
|
106
106
|
|
107
|
-
|
107
|
+
should 'roll back inner units if the outer unit is rolled back' do
|
108
108
|
outer_unit = create_uow
|
109
109
|
inner_unit = create_uow
|
110
110
|
|
@@ -117,7 +117,7 @@ module Synapse
|
|
117
117
|
outer_unit.rollback
|
118
118
|
end
|
119
119
|
|
120
|
-
|
120
|
+
should 'commit inner units after the outer unit is committed' do
|
121
121
|
outer_unit = create_uow
|
122
122
|
inner_unit = create_uow
|
123
123
|
|
@@ -138,7 +138,7 @@ module Synapse
|
|
138
138
|
assert committed, 'Inner unit should have been committed'
|
139
139
|
end
|
140
140
|
|
141
|
-
|
141
|
+
should 'rollback if a listener raises an exception while preparing to commit' do
|
142
142
|
cause = TestError.new
|
143
143
|
listener = UnitOfWorkListener.new
|
144
144
|
|
@@ -157,7 +157,7 @@ module Synapse
|
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
160
|
-
|
160
|
+
should 'rollback if an aggregate storage listener raises an exception' do
|
161
161
|
aggregate_root = Object.new
|
162
162
|
mock(aggregate_root).add_registration_listener
|
163
163
|
mock(aggregate_root).id
|
@@ -185,7 +185,7 @@ module Synapse
|
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
188
|
-
|
188
|
+
should 'rollback if the event bus raises an exception when publishing events' do
|
189
189
|
cause = TestError.new
|
190
190
|
event = Object.new
|
191
191
|
|
@@ -209,7 +209,7 @@ module Synapse
|
|
209
209
|
end
|
210
210
|
end
|
211
211
|
|
212
|
-
|
212
|
+
should 'delay cleanup of inner unit after commit until outer unit is committed' do
|
213
213
|
outer_listener = UnitOfWorkListener.new
|
214
214
|
inner_listener = UnitOfWorkListener.new
|
215
215
|
|
@@ -228,7 +228,7 @@ module Synapse
|
|
228
228
|
outer_unit.commit
|
229
229
|
end
|
230
230
|
|
231
|
-
|
231
|
+
should 'delay cleanup of inner unit after rollback until outer unit is committed' do
|
232
232
|
outer_listener = UnitOfWorkListener.new
|
233
233
|
inner_listener = UnitOfWorkListener.new
|
234
234
|
|
@@ -247,7 +247,7 @@ module Synapse
|
|
247
247
|
outer_unit.commit
|
248
248
|
end
|
249
249
|
|
250
|
-
|
250
|
+
should 'delay cleanup of inner unit after commit until outer unit is rolled back' do
|
251
251
|
outer_listener = UnitOfWorkListener.new
|
252
252
|
inner_listener = UnitOfWorkListener.new
|
253
253
|
|
@@ -267,7 +267,7 @@ module Synapse
|
|
267
267
|
outer_unit.rollback
|
268
268
|
end
|
269
269
|
|
270
|
-
|
270
|
+
should 'raise an exception if a transaction manager is set after the unit has been started' do
|
271
271
|
@uow.start
|
272
272
|
|
273
273
|
assert_raises RuntimeError do
|
@@ -277,7 +277,7 @@ module Synapse
|
|
277
277
|
@uow.commit
|
278
278
|
end
|
279
279
|
|
280
|
-
|
280
|
+
should 'not put the unit of work provider into a bad state if the unit of work fails during start' do
|
281
281
|
txm = Object.new
|
282
282
|
mock(txm).start {
|
283
283
|
raise 'Something bad happened'
|
@@ -292,7 +292,7 @@ module Synapse
|
|
292
292
|
refute @provider.started?
|
293
293
|
end
|
294
294
|
|
295
|
-
|
295
|
+
should 'continually publish events as events are published' do
|
296
296
|
@uow.start
|
297
297
|
|
298
298
|
event_bus = EventBus::SimpleEventBus.new
|
@@ -312,6 +312,8 @@ module Synapse
|
|
312
312
|
@uow.commit
|
313
313
|
end
|
314
314
|
|
315
|
+
private
|
316
|
+
|
315
317
|
def create_uow
|
316
318
|
uow = UnitOfWork.new @provider
|
317
319
|
uow.start
|
data/test/upcasting/data_test.rb
CHANGED
@@ -4,7 +4,8 @@ require 'ostruct'
|
|
4
4
|
module Synapse
|
5
5
|
module Upcasting
|
6
6
|
class UpcastSerializedDomainEventDataTest < Test::Unit::TestCase
|
7
|
-
|
7
|
+
|
8
|
+
should 'delegate properties correctly' do
|
8
9
|
delegate = OpenStruct.new
|
9
10
|
delegate.id = SecureRandom.uuid
|
10
11
|
delegate.metadata = Object.new
|
@@ -26,6 +27,7 @@ module Synapse
|
|
26
27
|
assert_same aggregate_id, upcast.aggregate_id
|
27
28
|
assert_same delegate.sequence_number, upcast.sequence_number
|
28
29
|
end
|
30
|
+
|
29
31
|
end
|
30
32
|
end
|
31
33
|
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synapse-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ian Unruh
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-06-03 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activesupport
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: atomic
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: logging
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,17 +55,15 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: thread
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
description: A versatile CQRS and event sourcing framework
|
@@ -100,7 +91,6 @@ files:
|
|
100
91
|
- lib/synapse/command/message.rb
|
101
92
|
- lib/synapse/command/async_command_bus.rb
|
102
93
|
- lib/synapse/command/interceptor_chain.rb
|
103
|
-
- lib/synapse/command/wiring.rb
|
104
94
|
- lib/synapse/command/command_filter.rb
|
105
95
|
- lib/synapse/command/gateway.rb
|
106
96
|
- lib/synapse/command/errors.rb
|
@@ -109,6 +99,7 @@ files:
|
|
109
99
|
- lib/synapse/command/filters/validation.rb
|
110
100
|
- lib/synapse/command/command_handler.rb
|
111
101
|
- lib/synapse/command/command_bus.rb
|
102
|
+
- lib/synapse/command/mapping.rb
|
112
103
|
- lib/synapse/event_store.rb
|
113
104
|
- lib/synapse/repository/lock_manager.rb
|
114
105
|
- lib/synapse/repository/pessimistic_lock_manager.rb
|
@@ -121,8 +112,9 @@ files:
|
|
121
112
|
- lib/synapse/event_sourcing/aggregate_factory.rb
|
122
113
|
- lib/synapse/event_sourcing/stream_decorator.rb
|
123
114
|
- lib/synapse/event_sourcing/entity.rb
|
124
|
-
- lib/synapse/event_sourcing/snapshot/
|
125
|
-
- lib/synapse/event_sourcing/snapshot/
|
115
|
+
- lib/synapse/event_sourcing/snapshot/aggregate_taker.rb
|
116
|
+
- lib/synapse/event_sourcing/snapshot/policy.rb
|
117
|
+
- lib/synapse/event_sourcing/snapshot/unit_listener.rb
|
126
118
|
- lib/synapse/event_sourcing/snapshot/taker.rb
|
127
119
|
- lib/synapse/event_sourcing/storage_listener.rb
|
128
120
|
- lib/synapse/event_sourcing/member.rb
|
@@ -147,7 +139,9 @@ files:
|
|
147
139
|
- lib/synapse/configuration/component/command_bus/gateway.rb
|
148
140
|
- lib/synapse/configuration/component/repository/simple_repository.rb
|
149
141
|
- lib/synapse/configuration/component/repository/locking_repository.rb
|
142
|
+
- lib/synapse/configuration/component/event_sourcing/aggregate_snapshot_taker.rb
|
150
143
|
- lib/synapse/configuration/component/event_sourcing/repository.rb
|
144
|
+
- lib/synapse/configuration/component/event_sourcing/interval_snapshot_policy.rb
|
151
145
|
- lib/synapse/configuration/component/upcasting/upcaster_chain.rb
|
152
146
|
- lib/synapse/configuration/component/upcasting.rb
|
153
147
|
- lib/synapse/configuration/component/serialization.rb
|
@@ -160,6 +154,8 @@ files:
|
|
160
154
|
- lib/synapse/configuration/component/event_bus.rb
|
161
155
|
- lib/synapse/configuration/component/command_bus.rb
|
162
156
|
- lib/synapse/configuration/container.rb
|
157
|
+
- lib/synapse/mapping/mapper.rb
|
158
|
+
- lib/synapse/mapping/mapping.rb
|
163
159
|
- lib/synapse/process_manager/process_repository.rb
|
164
160
|
- lib/synapse/process_manager/lock_manager.rb
|
165
161
|
- lib/synapse/process_manager/correlation_set.rb
|
@@ -168,12 +164,12 @@ files:
|
|
168
164
|
- lib/synapse/process_manager/repository/in_memory.rb
|
169
165
|
- lib/synapse/process_manager/correlation_resolver.rb
|
170
166
|
- lib/synapse/process_manager/process_manager.rb
|
167
|
+
- lib/synapse/process_manager/mapping/process_manager.rb
|
168
|
+
- lib/synapse/process_manager/mapping/process.rb
|
171
169
|
- lib/synapse/process_manager/process_factory.rb
|
172
170
|
- lib/synapse/process_manager/resource_injector.rb
|
173
171
|
- lib/synapse/process_manager/simple_process_manager.rb
|
174
172
|
- lib/synapse/process_manager/container_resource_injector.rb
|
175
|
-
- lib/synapse/process_manager/wiring/process_manager.rb
|
176
|
-
- lib/synapse/process_manager/wiring/process.rb
|
177
173
|
- lib/synapse/process_manager/process.rb
|
178
174
|
- lib/synapse/command.rb
|
179
175
|
- lib/synapse/common.rb
|
@@ -181,7 +177,6 @@ files:
|
|
181
177
|
- lib/synapse/event_store/event_store.rb
|
182
178
|
- lib/synapse/event_store/errors.rb
|
183
179
|
- lib/synapse/event_store/in_memory.rb
|
184
|
-
- lib/synapse/wiring.rb
|
185
180
|
- lib/synapse/configuration.rb
|
186
181
|
- lib/synapse/auditing/audit_logger.rb
|
187
182
|
- lib/synapse/auditing/data_provider.rb
|
@@ -199,13 +194,10 @@ files:
|
|
199
194
|
- lib/synapse/common/message_builder.rb
|
200
195
|
- lib/synapse/repository.rb
|
201
196
|
- lib/synapse/event_bus/simple_event_bus.rb
|
202
|
-
- lib/synapse/event_bus/wiring.rb
|
203
197
|
- lib/synapse/event_bus/event_publisher.rb
|
204
198
|
- lib/synapse/event_bus/event_listener.rb
|
205
199
|
- lib/synapse/event_bus/event_bus.rb
|
206
|
-
- lib/synapse/
|
207
|
-
- lib/synapse/wiring/message_wiring.rb
|
208
|
-
- lib/synapse/wiring/wire_registry.rb
|
200
|
+
- lib/synapse/event_bus/mapping.rb
|
209
201
|
- lib/synapse/domain/event_container.rb
|
210
202
|
- lib/synapse/domain/message.rb
|
211
203
|
- lib/synapse/domain/stream.rb
|
@@ -237,6 +229,7 @@ files:
|
|
237
229
|
- lib/synapse/serialization/serialized_object.rb
|
238
230
|
- lib/synapse/event_sourcing.rb
|
239
231
|
- lib/synapse/event_bus.rb
|
232
|
+
- lib/synapse/mapping.rb
|
240
233
|
- test/uow/factory_test.rb
|
241
234
|
- test/uow/uow_test.rb
|
242
235
|
- test/uow/outer_commit_listener_test.rb
|
@@ -248,10 +241,10 @@ files:
|
|
248
241
|
- test/command/gateway/retrying_callback_test.rb
|
249
242
|
- test/command/gateway/interval_retry_scheduler_test.rb
|
250
243
|
- test/command/gateway_test.rb
|
251
|
-
- test/command/wiring_test.rb
|
252
244
|
- test/command/simple_command_bus_test.rb
|
253
245
|
- test/command/async_command_bus_test.rb
|
254
246
|
- test/command/serialization_test.rb
|
247
|
+
- test/command/mapping_test.rb
|
255
248
|
- test/command/validation_test.rb
|
256
249
|
- test/repository/simple_repository_test.rb
|
257
250
|
- test/repository/pessimistic_test.rb
|
@@ -261,7 +254,7 @@ files:
|
|
261
254
|
- test/event_sourcing/storage_listener_test.rb
|
262
255
|
- test/event_sourcing/repository_test.rb
|
263
256
|
- test/event_sourcing/aggregate_root_test.rb
|
264
|
-
- test/event_sourcing/snapshot/
|
257
|
+
- test/event_sourcing/snapshot/interval_policy_test.rb
|
265
258
|
- test/event_sourcing/snapshot/aggregate_taker_test.rb
|
266
259
|
- test/event_sourcing/entity_test.rb
|
267
260
|
- test/event_sourcing/fixtures.rb
|
@@ -279,6 +272,9 @@ files:
|
|
279
272
|
- test/configuration/component/uow/unit_factory_test.rb
|
280
273
|
- test/configuration/component/command_bus/simple_command_bus_test.rb
|
281
274
|
- test/configuration/component/command_bus/async_command_bus_test.rb
|
275
|
+
- test/configuration/component/repository/simple_repository_test.rb
|
276
|
+
- test/configuration/component/event_sourcing/repository_test.rb
|
277
|
+
- test/configuration/component/upcasting/upcaster_chain_test.rb
|
282
278
|
- test/configuration/component/event_bus/simple_event_bus_test.rb
|
283
279
|
- test/configuration/component/serialization/serializer_test.rb
|
284
280
|
- test/configuration/component/serialization/converter_factory_test.rb
|
@@ -286,11 +282,11 @@ files:
|
|
286
282
|
- test/process_manager/correlation_set_test.rb
|
287
283
|
- test/process_manager/container_resource_injector_test.rb
|
288
284
|
- test/process_manager/simple_process_manager_test.rb
|
285
|
+
- test/process_manager/mapping/process_test.rb
|
286
|
+
- test/process_manager/mapping/process_manager_test.rb
|
287
|
+
- test/process_manager/mapping/fixtures.rb
|
289
288
|
- test/process_manager/correlation_test.rb
|
290
289
|
- test/process_manager/process_factory_test.rb
|
291
|
-
- test/process_manager/wiring/process_test.rb
|
292
|
-
- test/process_manager/wiring/process_manager_test.rb
|
293
|
-
- test/process_manager/wiring/fixtures.rb
|
294
290
|
- test/process_manager/in_memory_test.rb
|
295
291
|
- test/event_store/in_memory_test.rb
|
296
292
|
- test/auditing/dispatch_interceptor_test.rb
|
@@ -301,9 +297,7 @@ files:
|
|
301
297
|
- test/common/concurrency/identifier_lock_test.rb
|
302
298
|
- test/common/concurrency/public_lock_test.rb
|
303
299
|
- test/event_bus/publisher_test.rb
|
304
|
-
- test/event_bus/
|
305
|
-
- test/wiring/wire_registry_test.rb
|
306
|
-
- test/wiring/wire_test.rb
|
300
|
+
- test/event_bus/mapping_test.rb
|
307
301
|
- test/domain/stream_test.rb
|
308
302
|
- test/domain/aggregate_root_test.rb
|
309
303
|
- test/domain/message_test.rb
|
@@ -330,27 +324,26 @@ files:
|
|
330
324
|
homepage: https://github.com/ianunruh/synapse
|
331
325
|
licenses:
|
332
326
|
- Apache 2.0
|
327
|
+
metadata: {}
|
333
328
|
post_install_message:
|
334
329
|
rdoc_options: []
|
335
330
|
require_paths:
|
336
331
|
- lib
|
337
332
|
required_ruby_version: !ruby/object:Gem::Requirement
|
338
|
-
none: false
|
339
333
|
requirements:
|
340
|
-
- -
|
334
|
+
- - '>='
|
341
335
|
- !ruby/object:Gem::Version
|
342
336
|
version: '0'
|
343
337
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
344
|
-
none: false
|
345
338
|
requirements:
|
346
|
-
- -
|
339
|
+
- - '>='
|
347
340
|
- !ruby/object:Gem::Version
|
348
341
|
version: '0'
|
349
342
|
requirements: []
|
350
343
|
rubyforge_project:
|
351
|
-
rubygems_version:
|
344
|
+
rubygems_version: 2.0.3
|
352
345
|
signing_key:
|
353
|
-
specification_version:
|
346
|
+
specification_version: 4
|
354
347
|
summary: A versatile CQRS and event sourcing framework
|
355
348
|
test_files: []
|
356
349
|
has_rdoc:
|