torquebox-cache 2.3.2-java → 3.0.0.beta1-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,42 +9,47 @@ TORQUEBOX_APP_NAME = 'active-support-unit-test'
9
9
  describe ActiveSupport::Cache::TorqueBoxStore do
10
10
 
11
11
  before(:each) do
12
- manager = org.infinispan.manager.DefaultCacheManager.new
12
+ @manager = org.infinispan.manager.DefaultCacheManager.new
13
13
  service = org.projectodd.polyglot.cache.as.CacheService.new
14
- service.stub!(:cache_container).and_return( manager )
14
+ service.stub!(:cache_container).and_return( @manager )
15
+ TorqueBox::Registry.merge!("transaction-manager" => nil)
15
16
  TorqueBox::ServiceRegistry.stub!(:[]).with(org.projectodd.polyglot.cache.as.CacheService::CACHE).and_return( service )
16
17
  TorqueBox::ServiceRegistry.service_registry = nil
17
18
  @cache = ActiveSupport::Cache::TorqueBoxStore.new()
18
19
  end
19
20
 
21
+ after(:each) do
22
+ @manager.stop
23
+ end
24
+
20
25
  describe "basics" do
21
26
 
22
27
  it "should write and read a string" do
23
- @cache.write("key", "value").should be_true
28
+ @cache.write("key", "value")
24
29
  @cache.read("key").should == "value"
25
30
  end
26
31
 
27
32
  it "should write and read a number" do
28
- @cache.write("key", 42).should be_true
33
+ @cache.write("key", 42)
29
34
  @cache.read("key").should == 42
30
35
  end
31
36
 
32
37
  it "should exist after writing" do
33
- @cache.write("key", 42).should be_true
38
+ @cache.write("key", 42)
34
39
  @cache.exist?("key").should be_true
35
40
  end
36
41
 
37
42
  it "should be gone after deleting" do
38
- @cache.write("key", 42).should be_true
43
+ @cache.write("key", 42)
39
44
  @cache.read("key").should == 42
40
45
  @cache.delete("key").should be_true
41
46
  @cache.read("key").should be_nil
42
47
  end
43
48
 
44
49
  it "should overwrite an existing key" do
45
- @cache.write("key", 42).should be_true
50
+ @cache.write("key", 42)
46
51
  @cache.read("key").should == 42
47
- @cache.write("key", 44).should be_true
52
+ @cache.write("key", 44)
48
53
  @cache.read("key").should == 44
49
54
  end
50
55
 
@@ -53,22 +58,22 @@ describe ActiveSupport::Cache::TorqueBoxStore do
53
58
  describe "options" do
54
59
 
55
60
  it "should be expirable" do
56
- @cache.write("key", 42, :expires_in => 1.second).should be_true
61
+ @cache.write("key", 42, :expires_in => 1.second)
57
62
  @cache.read("key").should == 42
58
63
  sleep(1.1)
59
64
  @cache.read("key").should be_nil
60
65
  end
61
66
 
62
67
  it "should optionally not overwrite an existing key" do
63
- @cache.write("key", 42).should be_true
68
+ @cache.write("key", 42)
64
69
  @cache.read("key").should == 42
65
- @cache.write("key", 44, :unless_exist => true).should be_true
70
+ @cache.write("key", 44, :unless_exist => true)
66
71
  @cache.read("key").should == 42
67
72
  end
68
73
 
69
74
  it "should merge initialized options" do
70
75
  @cache = ActiveSupport::Cache::TorqueBoxStore.new(:expires_in => 1.second)
71
- @cache.write("key", 42).should be_true
76
+ @cache.write("key", 42)
72
77
  @cache.read("key").should == 42
73
78
  sleep(1.1)
74
79
  @cache.read("key").should be_nil
@@ -182,14 +187,14 @@ describe ActiveSupport::Cache::TorqueBoxStore do
182
187
  describe "advanced" do
183
188
 
184
189
  it "should support incrementation" do
185
- @cache.write("key", 42).should be_true
190
+ @cache.write("key", 42)
186
191
  @cache.read("key").should == 42
187
192
  @cache.increment("key").should == 43
188
193
  @cache.read("key").should == 43
189
194
  end
190
195
 
191
196
  it "should support decrementation" do
192
- @cache.write("key", 42).should be_true
197
+ @cache.write("key", 42)
193
198
  @cache.read("key").should == 42
194
199
  @cache.decrement("key").should == 41
195
200
  @cache.read("key").should == 41
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torquebox-cache
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 2.3.2
4
+ prerelease: 6
5
+ version: 3.0.0.beta1
6
6
  platform: java
7
7
  authors:
8
8
  - The TorqueBox Team
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-12 00:00:00.000000000 Z
12
+ date: 2013-07-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -49,13 +49,13 @@ dependencies:
49
49
  requirements:
50
50
  - - '='
51
51
  - !ruby/object:Gem::Version
52
- version: 2.3.2
52
+ version: 3.0.0.beta1
53
53
  none: false
54
54
  requirement: !ruby/object:Gem::Requirement
55
55
  requirements:
56
56
  - - '='
57
57
  - !ruby/object:Gem::Version
58
- version: 2.3.2
58
+ version: 3.0.0.beta1
59
59
  none: false
60
60
  prerelease: false
61
61
  type: :runtime
@@ -65,13 +65,13 @@ dependencies:
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 2.3.2
68
+ version: 3.0.0.beta1
69
69
  none: false
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - '='
73
73
  - !ruby/object:Gem::Version
74
- version: 2.3.2
74
+ version: 3.0.0.beta1
75
75
  none: false
76
76
  prerelease: false
77
77
  type: :runtime
@@ -114,24 +114,24 @@ executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
- - licenses/lgpl-2.1.txt
117
+ - licenses/cc0-1.0.txt
118
118
  - lib/torquebox-cache.jar
119
119
  - lib/torquebox-cache.rb
120
- - lib/polyglot-cache-1.12.2.jar
121
- - lib/sequence.rb
122
- - lib/cache.rb
123
- - lib/cache_listener.rb
120
+ - lib/polyglot-cache-1.14.0.jar
124
121
  - lib/gem_hook.rb
122
+ - lib/cache_listener.rb
123
+ - lib/cache.rb
124
+ - lib/active_support/cache/torquebox_store.rb
125
125
  - lib/active_support/cache/torque_box_store.rb
126
- - spec/cache_spec.rb
127
126
  - spec/cache_listener_spec.rb
128
- - spec/gem_hook_spec.rb
129
127
  - spec/torque_box_store_spec.rb
130
- - spec/spec.opts
128
+ - spec/gem_hook_spec.rb
131
129
  - spec/spec_helper.rb
130
+ - spec/spec.opts
131
+ - spec/cache_spec.rb
132
132
  homepage: http://torquebox.org/
133
133
  licenses:
134
- - lgpl
134
+ - Public Domain
135
135
  post_install_message:
136
136
  rdoc_options: []
137
137
  require_paths:
@@ -144,9 +144,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
144
  none: false
145
145
  required_rubygems_version: !ruby/object:Gem::Requirement
146
146
  requirements:
147
- - - '>='
147
+ - - '>'
148
148
  - !ruby/object:Gem::Version
149
- version: '0'
149
+ version: 1.3.1
150
150
  none: false
151
151
  requirements: []
152
152
  rubyforge_project:
@@ -155,7 +155,7 @@ signing_key:
155
155
  specification_version: 3
156
156
  summary: TorqueBox Cache Gem
157
157
  test_files:
158
- - spec/cache_spec.rb
159
158
  - spec/cache_listener_spec.rb
160
- - spec/gem_hook_spec.rb
161
159
  - spec/torque_box_store_spec.rb
160
+ - spec/gem_hook_spec.rb
161
+ - spec/cache_spec.rb
data/lib/sequence.rb DELETED
@@ -1,58 +0,0 @@
1
- # Copyright 2008-2013 Red Hat, Inc, and individual contributors.
2
- #
3
- # This is free software; you can redistribute it and/or modify it
4
- # under the terms of the GNU Lesser General Public License as
5
- # published by the Free Software Foundation; either version 2.1 of
6
- # the License, or (at your option) any later version.
7
- #
8
- # This software is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
- # Lesser General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public
14
- # License along with this software; if not, write to the Free
15
- # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
16
- # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
17
-
18
- module TorqueBox
19
- module Infinispan
20
-
21
- class Sequence
22
- include java.io.Serializable
23
-
24
- class Codec
25
- def self.encode(sequence)
26
- sequence.value.to_s
27
- end
28
-
29
- def self.decode(sequence_bytes)
30
- sequence_bytes && Sequence.new( sequence_bytes.to_s.to_i )
31
- end
32
- end
33
-
34
- def initialize(amount = 1)
35
- @data = amount
36
- end
37
-
38
- def value
39
- @data ? @data.to_i : @data
40
- end
41
-
42
- def next(amount = 1)
43
- Sequence.new( @data.to_i + amount )
44
- end
45
-
46
- def ==(other)
47
- self.value == other.value
48
- end
49
-
50
- def to_s
51
- "Sequence: #{self.value}"
52
- end
53
- end
54
-
55
- end
56
- end
57
-
58
-