Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.

Commit 13ce2bd

Browse files
committed
Upgrade to latest WunderBoss release and WildFly 10.0.0.Final
The WunderBoss and WildFly upgrade also required some fairly hefty changes to static content handling when running inside of WildFly. All the integration tests pass, so confidence is high that things are working properly.
1 parent 9edf4eb commit 13ce2bd

File tree

15 files changed

+279
-27
lines changed

15 files changed

+279
-27
lines changed

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ task 'build' do
5252
puts " #{File.basename(gem)}: #{size_kb} KB"
5353
end
5454
puts " Total: #{total_size_kb} KB"
55-
max_size_kb = 10752
55+
max_size_kb = 15360
5656
if total_size_kb > max_size_kb
5757
puts "ERROR: Maximum combined gem size of #{max_size_kb} KB exceeded"
5858
exit 1

caching/lib/torquebox/caching.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ class << self
9494
# @return [Cache] The cache reference
9595
def cache(name, options = {})
9696
validate_options(options, VALID_OPTIONS)
97+
if options[:max_entries].to_i > 0 && !options[:eviction]
98+
options[:eviction] = :lru
99+
end
97100
cache = component.find_or_create(name, extract_options(options, Caching::CreateOption))
98101
codec = Codecs[options.fetch(:encoding, :marshal_smart)]
99102
Cache.new(component.withCodec(cache, codec), options)

caching/spec/cache_spec.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,21 +422,22 @@ def cache_on_disk(dir = nil, name = nil)
422422

423423
describe "event notifications" do
424424
it "should add and remove cache listeners" do
425+
num_orig_listeners = @cache.get_listeners.size
425426
l1 = @cache.add_listener(:cache_entry_loaded)
426427
l2 = @cache.add_listener(:cache_entry_visited, :cache_entry_removed)
427428
l1.size.should == 1
428429
l2.size.should == 2
429-
@cache.get_listeners.size.should == 3
430+
(@cache.get_listeners.size - num_orig_listeners).should == 3
430431
@cache.remove_listener(l1.first)
431-
@cache.get_listeners.size.should == 2
432+
(@cache.get_listeners.size - num_orig_listeners).should == 2
432433
@cache.get_listeners.each { |x| @cache.remove_listener(x) }
433434
@cache.get_listeners.size.should == 0
434435
end
435436

436437
it "should reject bad event types" do
437-
@cache.get_listeners.should be_empty
438+
num_orig_listeners = @cache.get_listeners.size
438439
expect { @cache.add_listener(:cache_entry_visited, :this_should_barf) }.to raise_error(Java::JavaLang::IllegalArgumentException)
439-
@cache.get_listeners.should be_empty
440+
(@cache.get_listeners.size - num_orig_listeners).should == 0
440441
end
441442
end
442443
end

caching/torquebox-caching.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ Gem::Specification.new do |s|
2525

2626
s.requirements << "jar org.projectodd.wunderboss:wunderboss-ruby, #{TorqueBox::WUNDERBOSS_VERSION}"
2727
s.requirements << "jar org.projectodd.wunderboss:wunderboss-caching, #{TorqueBox::WUNDERBOSS_VERSION}"
28+
s.requirements << "jar org.projectodd.wunderboss:wunderboss-wildfly-caching, #{TorqueBox::WUNDERBOSS_VERSION}"
2829
end

core/ext/torquebox-core/org/torquebox/core/JarBuilder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,9 @@ protected void writeCurrentEntry(JarOutputStream jarOutput, InputStream value) t
189189
protected void writeCurrentEntry(JarOutputStream jarOutput, String name, List value) throws IOException {
190190
for (Object part : value) {
191191
writeCurrentEntry(jarOutput, name, part);
192-
if (name.endsWith(".properties")) {
193-
// duplicate .properties entries are joined by concatenating them together
192+
if (name.endsWith(".properties") || name.contains("META-INF/services/")) {
193+
// duplicate .properties and META-INF/services entries are
194+
// joined by concatenating them together
194195
writeCurrentEntry(jarOutput, new ByteArrayInputStream("\n".getBytes("UTF-8")));
195196
} else {
196197
// for everything else, first entry added wins

core/lib/torquebox-core.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def list
4646

4747
class << self
4848
def in_wildfly?
49-
!org.projectodd.wunderboss.WunderBoss.options.get('wildfly-service').nil?
49+
org.projectodd.wunderboss.WunderBoss.inWildFly()
5050
end
5151
end
5252
end

core/lib/torquebox/version.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515

1616
module TorqueBox
1717
VERSION = '4.0.0.beta3.dev'
18-
WUNDERBOSS_VERSION = '0.8.x.incremental.4'
19-
WILDFLY_VERSION = '9.0.1.Final'
18+
WUNDERBOSS_VERSION = '0.12.1'
19+
WILDFLY_VERSION = '10.0.0.Final'
2020
end

core/torquebox-core.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ Gem::Specification.new do |s|
2424
s.add_development_dependency('rspec', '~> 2.14')
2525

2626
s.requirements << "jar org.projectodd.wunderboss:wunderboss-ruby, #{TorqueBox::WUNDERBOSS_VERSION}"
27-
s.requirements << "jar org.projectodd.wunderboss:wunderboss-wildfly, #{TorqueBox::WUNDERBOSS_VERSION}"
27+
s.requirements << "jar org.projectodd.wunderboss:wunderboss-wildfly-core, #{TorqueBox::WUNDERBOSS_VERSION}"
2828
end

docs/caching.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,12 @@ And if the `:persist` option is set, evicted entries are not deleted
131131
but rather flushed to disk so that the entries in memory are always a
132132
finite subset of those on disk.
133133

134-
The default eviction policy is [:lirs], which is an optimized version
135-
of `:lru` (Least Recently Used).
134+
The default eviction policy is `:none`. Other options are `:lru`
135+
(Least Recently Used) and `:lirs`, which is an optimized but less
136+
predictable version of `:lru`.
137+
138+
Setting a `:max_entries` option without also specifying an `:eviction`
139+
policy will result in the `:lru` policy being set for you.
136140

137141
baz = TorqueBox::Caching.cache "baz", :max_entries => 3
138142
baz[:a] = 1
@@ -162,14 +166,11 @@ modified in the baz cache:
162166

163167
result = baz.add_listener(:cache_entry_visited, :cache_entry_modified) {|e| puts e}
164168

165-
baz.get_listeners.size #=> 2
166-
167169
# This should show two messages for each event (before/after)
168170
baz[:b] = baz[:b] + 1
169171

170-
# This should turn the notifications off
172+
# This removes the listeners and turns the messages off
171173
result.each {|v| baz.remove_listener(v)}
172-
baz.get_listeners.empty? #=> true
173174

174175
### Encoding
175176

integration-tests/spec/alacarte_messaging_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@
3939
def with_context(&block)
4040
type = wildfly? ? :hornetq_wildfly : :hornetq_standalone
4141
port = wildfly? ? 8080 : 5445
42+
username = wildfly? ? "testuser" : nil
43+
password = wildfly? ? "testuser1!" : nil
4244
TorqueBox::Messaging::Context.new(:host => "localhost",
4345
:port => port,
4446
:remote_type => type,
47+
:username => username,
48+
:password => password,
4549
&block)
4650
end
4751
end

0 commit comments

Comments
 (0)