torquebox-cache 3.0.0.beta2-java → 3.0.0-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.
- data/lib/active_support/cache/torque_box_store.rb +1 -1
- data/lib/gem_hook.rb +1 -1
- data/lib/{polyglot-cache-1.14.0.jar → polyglot-cache-1.16.0.jar} +0 -0
- data/lib/{cache.rb → torquebox/cache.rb} +0 -0
- data/lib/torquebox-cache.jar +0 -0
- data/lib/torquebox-cache.rb +3 -3
- data/spec/spec_helper.rb +1 -1
- metadata +15 -18
- data/lib/cache_listener.rb +0 -52
- data/spec/cache_listener_spec.rb +0 -99
data/lib/gem_hook.rb
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
16
16
|
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
17
17
|
|
18
|
-
require 'cache'
|
18
|
+
require 'torquebox/cache'
|
19
19
|
begin
|
20
20
|
ActiveSupport
|
21
21
|
require 'active_support/cache/torque_box_store.rb'
|
Binary file
|
File without changes
|
data/lib/torquebox-cache.jar
CHANGED
Binary file
|
data/lib/torquebox-cache.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module TorqueboxCache
|
2
|
-
VERSION = '3.0.0
|
3
|
-
MAVEN_VERSION = '3.0.0
|
2
|
+
VERSION = '3.0.0'
|
3
|
+
MAVEN_VERSION = '3.0.0'
|
4
4
|
end
|
5
5
|
begin
|
6
6
|
require 'java'
|
7
7
|
require File.dirname(__FILE__) + '/torquebox-cache.jar'
|
8
|
-
require File.dirname(__FILE__) + '/polyglot-cache-1.
|
8
|
+
require File.dirname(__FILE__) + '/polyglot-cache-1.16.0.jar'
|
9
9
|
rescue LoadError
|
10
10
|
puts 'JAR-based gems require JRuby to load. Please visit www.jruby.org.'
|
11
11
|
raise
|
data/spec/spec_helper.rb
CHANGED
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: 3.0.0
|
4
|
+
prerelease:
|
5
|
+
version: 3.0.0
|
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-08-
|
12
|
+
date: 2013-08-28 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: 3.0.0
|
52
|
+
version: 3.0.0
|
53
53
|
none: false
|
54
54
|
requirement: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
56
|
- - '='
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
version: 3.0.0
|
58
|
+
version: 3.0.0
|
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: 3.0.0
|
68
|
+
version: 3.0.0
|
69
69
|
none: false
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - '='
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 3.0.0
|
74
|
+
version: 3.0.0
|
75
75
|
none: false
|
76
76
|
prerelease: false
|
77
77
|
type: :runtime
|
@@ -117,18 +117,16 @@ files:
|
|
117
117
|
- licenses/cc0-1.0.txt
|
118
118
|
- lib/torquebox-cache.jar
|
119
119
|
- lib/torquebox-cache.rb
|
120
|
-
- lib/polyglot-cache-1.
|
121
|
-
- lib/cache.rb
|
120
|
+
- lib/polyglot-cache-1.16.0.jar
|
122
121
|
- lib/gem_hook.rb
|
123
|
-
- lib/
|
124
|
-
- lib/active_support/cache/torque_box_store.rb
|
122
|
+
- lib/torquebox/cache.rb
|
125
123
|
- lib/active_support/cache/torquebox_store.rb
|
126
|
-
-
|
127
|
-
- spec/cache_spec.rb
|
124
|
+
- lib/active_support/cache/torque_box_store.rb
|
128
125
|
- spec/spec.opts
|
129
|
-
- spec/cache_listener_spec.rb
|
130
126
|
- spec/spec_helper.rb
|
131
127
|
- spec/torque_box_store_spec.rb
|
128
|
+
- spec/gem_hook_spec.rb
|
129
|
+
- spec/cache_spec.rb
|
132
130
|
homepage: http://torquebox.org/
|
133
131
|
licenses:
|
134
132
|
- Public Domain
|
@@ -144,9 +142,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
142
|
none: false
|
145
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
144
|
requirements:
|
147
|
-
- - '
|
145
|
+
- - '>='
|
148
146
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
147
|
+
version: '0'
|
150
148
|
none: false
|
151
149
|
requirements: []
|
152
150
|
rubyforge_project:
|
@@ -155,7 +153,6 @@ signing_key:
|
|
155
153
|
specification_version: 3
|
156
154
|
summary: TorqueBox Cache Gem
|
157
155
|
test_files:
|
156
|
+
- spec/torque_box_store_spec.rb
|
158
157
|
- spec/gem_hook_spec.rb
|
159
158
|
- spec/cache_spec.rb
|
160
|
-
- spec/cache_listener_spec.rb
|
161
|
-
- spec/torque_box_store_spec.rb
|
data/lib/cache_listener.rb
DELETED
@@ -1,52 +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
|
-
require 'jruby/core_ext'
|
19
|
-
|
20
|
-
module TorqueBox
|
21
|
-
module Infinispan
|
22
|
-
class CacheListener
|
23
|
-
|
24
|
-
def event_fired( event )
|
25
|
-
event_type = event.get_type.to_s.downcase
|
26
|
-
if respond_to? event_type
|
27
|
-
self.send( event_type, event )
|
28
|
-
else
|
29
|
-
puts "#{self.class.name}##{event_type} not implemented."
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
if JRUBY_VERSION =~ /^1\.7/
|
34
|
-
add_class_annotations( { org.infinispan.notifications.Listener => { } } )
|
35
|
-
else
|
36
|
-
add_class_annotation( { org.infinispan.notifications.Listener => { } } )
|
37
|
-
end
|
38
|
-
add_method_signature( "event_fired", [java.lang.Void::TYPE, org.infinispan.notifications.cachelistener.event.Event] )
|
39
|
-
add_method_annotation( "event_fired",
|
40
|
-
{ org.infinispan.notifications.cachelistener.annotation.CacheEntryCreated => {},
|
41
|
-
org.infinispan.notifications.cachelistener.annotation.CacheEntryRemoved => {},
|
42
|
-
org.infinispan.notifications.cachelistener.annotation.CacheEntryModified => {},
|
43
|
-
org.infinispan.notifications.cachelistener.annotation.CacheEntryEvicted => {},
|
44
|
-
org.infinispan.notifications.cachelistener.annotation.CacheEntryActivated => {},
|
45
|
-
org.infinispan.notifications.cachelistener.annotation.CacheEntryEvicted => {},
|
46
|
-
org.infinispan.notifications.cachelistener.annotation.CacheEntryVisited => {}})
|
47
|
-
become_java!
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
|
data/spec/cache_listener_spec.rb
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright 2011 Red Hat, Inc.
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
|
17
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
18
|
-
require 'cache_listener'
|
19
|
-
|
20
|
-
describe TorqueBox::Infinispan::CacheListener do
|
21
|
-
before :each do
|
22
|
-
@manager = org.infinispan.manager.DefaultCacheManager.new
|
23
|
-
service = org.projectodd.polyglot.cache.as.CacheService.new
|
24
|
-
service.stub!(:cache_container).and_return( @manager )
|
25
|
-
TorqueBox::Registry.merge!("transaction-manager" => nil)
|
26
|
-
TorqueBox::ServiceRegistry.stub!(:[]).with(org.projectodd.polyglot.cache.as.CacheService::CACHE).and_return( service )
|
27
|
-
@cache = TorqueBox::Infinispan::Cache.new( :name => 'foo-cache' )
|
28
|
-
end
|
29
|
-
|
30
|
-
after :each do
|
31
|
-
@cache.clear
|
32
|
-
@manager.stop
|
33
|
-
end
|
34
|
-
|
35
|
-
it "the cache should accept listeners" do
|
36
|
-
@cache.should respond_to :add_listener
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should notify when an entry is added to the cache" do
|
40
|
-
listener = TestListener.new
|
41
|
-
@cache.add_listener( listener )
|
42
|
-
listener.should_receive( :cache_entry_created ).at_least :once
|
43
|
-
@cache.put("akey", "avalue")
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should notify when an entry is deleted from the cache" do
|
47
|
-
listener = TestListener.new
|
48
|
-
@cache.add_listener( listener )
|
49
|
-
@cache.put("akey", "avalue")
|
50
|
-
listener.should_receive( :cache_entry_removed ).at_least :once
|
51
|
-
@cache.remove("akey")
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should notify when an entry is retrieved from the cache" do
|
55
|
-
listener = TestListener.new
|
56
|
-
@cache.add_listener( listener )
|
57
|
-
@cache.put("akey", "avalue")
|
58
|
-
listener.should_receive( :cache_entry_visited ).at_least :once
|
59
|
-
@cache.get("akey")
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should notify when an entry is modified in the cache" do
|
63
|
-
listener = TestListener.new
|
64
|
-
@cache.add_listener( listener )
|
65
|
-
@cache.put("akey", "avalue")
|
66
|
-
listener.should_receive( :cache_entry_modified ).at_least :once
|
67
|
-
@cache.put("akey", "another value")
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should notify when an entry is activated in the cache" do
|
71
|
-
pending "Figuring out why this doesn't work"
|
72
|
-
listener = TestListener.new
|
73
|
-
cache = TorqueBox::Infinispan::Cache.new( :name => 'foo-cache', :persist=>true )
|
74
|
-
cache.add_listener( listener )
|
75
|
-
cache.put("akey", "avalue")
|
76
|
-
cache.evict("akey")
|
77
|
-
listener.should_receive( :cache_entry_activated ).at_least :once
|
78
|
-
cache.get("akey")
|
79
|
-
end
|
80
|
-
|
81
|
-
it "should notify when an entry is evicted in the cache" do
|
82
|
-
listener = TestListener.new
|
83
|
-
@cache.add_listener( listener )
|
84
|
-
@cache.put("akey", "avalue")
|
85
|
-
listener.should_receive( :cache_entry_evicted ).at_least :once
|
86
|
-
@cache.evict( "akey" )
|
87
|
-
end
|
88
|
-
|
89
|
-
end
|
90
|
-
|
91
|
-
class TestListener < TorqueBox::Infinispan::CacheListener
|
92
|
-
def cache_entry_created(entry) ; end
|
93
|
-
def cache_entry_removed(entry) ; end
|
94
|
-
def cache_entry_visited(entry) ; end
|
95
|
-
def cache_entry_modified(entry) ; end
|
96
|
-
def cache_entry_evicted(entry) ; end
|
97
|
-
def cache_entry_activated(entry) ; end
|
98
|
-
end
|
99
|
-
|