euston-eventstore 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'euston-eventstore'
3
- s.version = '1.2.3'
4
- s.date = '2011-10-31'
3
+ s.version = '1.2.4'
4
+ s.date = '2012-02-02'
5
5
  s.platform = RUBY_PLATFORM.to_s == 'java' ? 'java' : Gem::Platform::RUBY
6
6
  s.authors = ['Lee Henson', 'Guy Boertje']
7
7
  s.email = ['lee.m.henson@gmail.com', 'guyboertje@gmail.com']
@@ -53,7 +53,7 @@ Gem::Specification.new do |s|
53
53
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
54
54
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
55
55
 
56
- s.add_dependency 'activesupport', '>= 3.0.10'
56
+ s.add_dependency 'activesupport', '~> 3.1.0'
57
57
  s.add_dependency 'euston', '~> 1.2.2'
58
58
  s.add_dependency 'hash-keys', '~> 1.0.0'
59
59
 
@@ -9,9 +9,9 @@ module Euston
9
9
  end
10
10
 
11
11
  def save aggregate
12
- stream = event_store.open_stream :stream_id => aggregate.aggregate_id
13
- aggregate.uncommitted_events.each { |e| stream << EventStore::EventMessage.new(e.to_hash.stringify__keys) }
14
- aggregate.uncommitted_commands.each { |c| stream << EventStore::CommandMessage.new(c.to_hash.stringify__keys) }
12
+ stream = aggregate.stream
13
+ aggregate.uncommitted_events.each { |e| stream << EventStore::Persistence::Mongodb::MongoEventMessage.new(e.to_hash.stringify__keys) }
14
+ aggregate.uncommitted_commands.each { |c| stream << EventStore::Persistence::Mongodb::MongoCommandMessage.new(c.to_hash.stringify__keys) }
15
15
  stream.uncommitted_headers[:aggregate_type] = aggregate.class.to_s
16
16
  stream.commit_changes Euston.uuid.generate
17
17
  end
@@ -1,5 +1,5 @@
1
1
  module Euston
2
2
  module EventStore
3
- VERSION = "1.2.3"
3
+ VERSION = "1.2.4"
4
4
  end
5
5
  end
@@ -223,34 +223,31 @@ describe Euston::EventStore do
223
223
  @persistence.get_streams_to_snapshot(1).detect { |x| x.stream_id == stream_id }.should be_nil }
224
224
  end
225
225
 
226
- # Timing issues with this one?
227
- #
228
- # context 'when adding a commit after a snapshot' do
229
- # let(:within_threshold) { 2 }
230
- # let(:over_threshold) { 3 }
231
- # let(:snapshot_data) { { :key => :value } }
232
- # let(:oldest) { new_attempt }
233
- # let(:oldest2) { next_attempt oldest }
234
- # let(:newest) { next_attempt oldest2 }
235
-
236
- # before do
237
- # @persistence.commit oldest
238
- # @persistence.commit oldest2
239
-
240
- # sleep 0.25
241
-
242
- # @persistence.add_snapshot Euston::EventStore::Snapshot.new(stream_id, oldest2.stream_revision, snapshot_data)
243
- # @persistence.commit newest
244
- # end
245
-
246
- # it 'finds the stream in the set of streams to be snapshot when within the threshold' do
247
- # @persistence.get_streams_to_snapshot(within_threshold).detect { |x| x.stream_id == stream_id }.should_not be_nil
248
- # end
249
-
250
- # it 'does not find the stream in the set of stream to be snapshot when over the threshold' do
251
- # @persistence.get_streams_to_snapshot(over_threshold).detect { |x| x.stream_id == stream_id }.should be_nil
252
- # end
253
- # end
226
+ context 'when adding a commit after a snapshot' do
227
+ let(:within_threshold) { 2 }
228
+ let(:over_threshold) { 3 }
229
+ let(:snapshot_data) { { :key => :value } }
230
+ let(:oldest) { new_attempt }
231
+ let(:oldest2) { next_attempt oldest }
232
+ let(:newest) { next_attempt oldest2 }
233
+
234
+ before do
235
+ @persistence.commit oldest
236
+ @persistence.commit oldest2
237
+ @persistence.add_snapshot Euston::EventStore::Snapshot.new(stream_id, oldest2.stream_revision, snapshot_data)
238
+ @persistence.commit newest
239
+
240
+ sleep 0.5 # needed because the stream head update is done asynchronously
241
+ end
242
+
243
+ it 'finds the stream in the set of streams to be snapshot when within the threshold' do
244
+ @persistence.get_streams_to_snapshot(within_threshold).detect { |x| x.stream_id == stream_id }.should_not be_nil
245
+ end
246
+
247
+ it 'does not find the stream in the set of stream to be snapshot when over the threshold' do
248
+ @persistence.get_streams_to_snapshot(over_threshold).detect { |x| x.stream_id == stream_id }.should be_nil
249
+ end
250
+ end
254
251
 
255
252
  context 'when reading all commits from a particular point in time' do
256
253
  let(:now) { Time.now.utc + (60 * 60 * 24 * 7 * 52) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: euston-eventstore
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,22 +10,22 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-10-31 00:00:00.000000000 Z
13
+ date: 2012-02-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
17
- requirement: &85699110 !ruby/object:Gem::Requirement
17
+ requirement: &70184421928780 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
- - - ! '>='
20
+ - - ~>
21
21
  - !ruby/object:Gem::Version
22
- version: 3.0.10
22
+ version: 3.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *85699110
25
+ version_requirements: *70184421928780
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: euston
28
- requirement: &85698830 !ruby/object:Gem::Requirement
28
+ requirement: &70184421926000 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 1.2.2
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *85698830
36
+ version_requirements: *70184421926000
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: hash-keys
39
- requirement: &85698590 !ruby/object:Gem::Requirement
39
+ requirement: &70184421945140 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.0.0
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *85698590
47
+ version_requirements: *70184421945140
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: bson
50
- requirement: &85698320 !ruby/object:Gem::Requirement
50
+ requirement: &70184421957780 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 1.3.0
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *85698320
58
+ version_requirements: *70184421957780
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: bson_ext
61
- requirement: &85698080 !ruby/object:Gem::Requirement
61
+ requirement: &70184421956060 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 1.3.0
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *85698080
69
+ version_requirements: *70184421956060
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: json
72
- requirement: &85697820 !ruby/object:Gem::Requirement
72
+ requirement: &70184421955380 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 1.5.0
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *85697820
80
+ version_requirements: *70184421955380
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: mongo
83
- requirement: &85697550 !ruby/object:Gem::Requirement
83
+ requirement: &70184421952460 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: 1.3.0
89
89
  type: :runtime
90
90
  prerelease: false
91
- version_requirements: *85697550
91
+ version_requirements: *70184421952460
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: uuid
94
- requirement: &85697210 !ruby/object:Gem::Requirement
94
+ requirement: &70184421970540 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ~>
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: 2.3.0
100
100
  type: :runtime
101
101
  prerelease: false
102
- version_requirements: *85697210
102
+ version_requirements: *70184421970540
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: awesome_print
105
- requirement: &85696820 !ruby/object:Gem::Requirement
105
+ requirement: &70184421969020 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ~>
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: 0.4.0
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *85696820
113
+ version_requirements: *70184421969020
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: fuubar
116
- requirement: &85696250 !ruby/object:Gem::Requirement
116
+ requirement: &70184421968180 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ~>
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: 0.0.0
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *85696250
124
+ version_requirements: *70184421968180
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rake
127
- requirement: &85685960 !ruby/object:Gem::Requirement
127
+ requirement: &70184421966060 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ~>
@@ -132,10 +132,10 @@ dependencies:
132
132
  version: 0.9.2
133
133
  type: :development
134
134
  prerelease: false
135
- version_requirements: *85685960
135
+ version_requirements: *70184421966060
136
136
  - !ruby/object:Gem::Dependency
137
137
  name: rspec
138
- requirement: &85684960 !ruby/object:Gem::Requirement
138
+ requirement: &70184421965180 !ruby/object:Gem::Requirement
139
139
  none: false
140
140
  requirements:
141
141
  - - ~>
@@ -143,7 +143,7 @@ dependencies:
143
143
  version: 2.6.0
144
144
  type: :development
145
145
  prerelease: false
146
- version_requirements: *85684960
146
+ version_requirements: *70184421965180
147
147
  description: Ruby port for Jonathan Oliver's EventStore. See https://github.com/joliver/EventStore
148
148
  for details.
149
149
  email:
@@ -214,4 +214,12 @@ rubygems_version: 1.8.10
214
214
  signing_key:
215
215
  specification_version: 3
216
216
  summary: Event store for use with Euston.
217
- test_files: []
217
+ test_files:
218
+ - spec/event_store/dispatcher/asynchronous_dispatcher_spec.rb
219
+ - spec/event_store/dispatcher/synchronous_dispatcher_spec.rb
220
+ - spec/event_store/optimistic_event_store_spec.rb
221
+ - spec/event_store/optimistic_event_stream_spec.rb
222
+ - spec/event_store/persistence/mongodb_spec.rb
223
+ - spec/event_store/serialization/simple_message.rb
224
+ - spec/spec_helper.rb
225
+ - spec/support/array_enumeration_counter.rb