euston-eventstore 1.2.3-java → 1.2.4-java

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.
@@ -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
@@ -2,7 +2,7 @@
2
2
  name: euston-eventstore
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.2.3
5
+ version: 1.2.4
6
6
  platform: java
7
7
  authors:
8
8
  - Lee Henson
@@ -10,15 +10,15 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-10-31 00:00:00.000000000Z
13
+ date: 2012-02-02 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
17
17
  version_requirements: &2058 !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 3.0.10
21
+ version: 3.1.0
22
22
  none: false
23
23
  requirement: *2058
24
24
  prerelease: false
@@ -180,5 +180,13 @@ rubygems_version: 1.8.9
180
180
  signing_key:
181
181
  specification_version: 3
182
182
  summary: Event store for use with Euston.
183
- test_files: []
183
+ test_files:
184
+ - spec/event_store/dispatcher/asynchronous_dispatcher_spec.rb
185
+ - spec/event_store/dispatcher/synchronous_dispatcher_spec.rb
186
+ - spec/event_store/optimistic_event_store_spec.rb
187
+ - spec/event_store/optimistic_event_stream_spec.rb
188
+ - spec/event_store/persistence/mongodb_spec.rb
189
+ - spec/event_store/serialization/simple_message.rb
190
+ - spec/spec_helper.rb
191
+ - spec/support/array_enumeration_counter.rb
184
192
  ...