torquebox-backstage 0.1.2 → 0.2.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ * 0.2.0
2
+ * if the queue isn't available via jndi, just log an error instead of raising
3
+ * updated to use the TorqueBox 1.0.0.CR2 gems
4
+
5
+ * 0.1.2 and earlier
6
+ * stuff happened
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ gem "rack-flash"
5
5
  gem 'haml', '~>3.0'
6
6
  gem "jmx", '0.7'
7
7
  gem 'json'
8
- gem 'torquebox', '1.0.0.CR1'
8
+ gem 'torquebox', '1.0.0.CR2'
9
9
  gem 'tobias-sinatra-url-for'
10
10
  gem 'rack-accept'
11
11
 
data/Gemfile.lock CHANGED
@@ -33,21 +33,21 @@ GEM
33
33
  tilt (1.2.2)
34
34
  tobias-sinatra-url-for (0.2.1)
35
35
  sinatra (>= 0.9.1.1)
36
- torquebox (1.0.0.CR1)
37
- torquebox-base (= 1.0.0.CR1)
38
- torquebox-messaging (= 1.0.0.CR1)
39
- torquebox-naming (= 1.0.0.CR1)
40
- torquebox-rake-support (= 1.0.0.CR1)
41
- torquebox-vfs (= 1.0.0.CR1)
42
- torquebox-web (= 1.0.0.CR1)
43
- torquebox-base (1.0.0.CR1-java)
44
- torquebox-messaging (1.0.0.CR1-java)
45
- torquebox-base (= 1.0.0.CR1)
46
- torquebox-naming (= 1.0.0.CR1)
47
- torquebox-naming (1.0.0.CR1-java)
48
- torquebox-rake-support (1.0.0.CR1)
49
- torquebox-vfs (1.0.0.CR1-java)
50
- torquebox-web (1.0.0.CR1-java)
36
+ torquebox (1.0.0.CR2)
37
+ torquebox-base (= 1.0.0.CR2)
38
+ torquebox-messaging (= 1.0.0.CR2)
39
+ torquebox-naming (= 1.0.0.CR2)
40
+ torquebox-rake-support (= 1.0.0.CR2)
41
+ torquebox-vfs (= 1.0.0.CR2)
42
+ torquebox-web (= 1.0.0.CR2)
43
+ torquebox-base (1.0.0.CR2-java)
44
+ torquebox-messaging (1.0.0.CR2-java)
45
+ torquebox-base (= 1.0.0.CR2)
46
+ torquebox-naming (= 1.0.0.CR2)
47
+ torquebox-naming (1.0.0.CR2-java)
48
+ torquebox-rake-support (1.0.0.CR2)
49
+ torquebox-vfs (1.0.0.CR2-java)
50
+ torquebox-web (1.0.0.CR2-java)
51
51
  watchr (0.7)
52
52
 
53
53
  PLATFORMS
@@ -65,5 +65,5 @@ DEPENDENCIES
65
65
  sinatra (= 1.1.2)
66
66
  thor
67
67
  tobias-sinatra-url-for
68
- torquebox (= 1.0.0.CR1)
68
+ torquebox (= 1.0.0.CR2)
69
69
  watchr
data/TODO CHANGED
@@ -1,9 +1,8 @@
1
1
  TODO
2
2
 
3
- * allow queue browsing from the API
4
- * link queues/topics to their apps
5
- * see how backstage behaves in a cluster
6
- * allow resending DLQ and ExpiryQueue messages
7
- * store failure backtraces for jobs/tasks in TorqueBox, and display here
3
+ * link queues/topics to their apps (requires TB changes)
4
+ * see how backstage behaves in a cluster
5
+ * allow resending DLQ and ExpiryQueue messages (requires replacing the external (client) queuebrowser with one based off of the mbean listMessages)
6
+ * store failure backtraces for jobs/tasks in TorqueBox, and display here (requires TB changes)
8
7
  * improve test coverage
9
8
  * add stats collection, with memory usage and other bits? ruby runtime stats?
data/TORQUEBOX_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.RC1-SNAPSHOT
1
+ 1.0.0.CR2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.0
data/backstage.rb CHANGED
@@ -14,7 +14,6 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- #require 'bundler/setup'
18
17
  require 'sinatra/base'
19
18
  require 'rack-flash'
20
19
  require 'rack/accept'
@@ -42,6 +42,9 @@ module Backstage
42
42
  message.parent = self
43
43
  yield message
44
44
  end
45
+ rescue Exception => ex
46
+ puts "WARNING - failed to access messages for queue #{jndi_name}: #{ex}"
47
+ puts ex.backtrace.join( "\n" )
45
48
  end
46
49
 
47
50
  def display_name
@@ -29,5 +29,8 @@ module Backstage
29
29
  super + [:durable]
30
30
  end
31
31
 
32
+ def subcollections
33
+ [:messages]
34
+ end
32
35
  end
33
36
  end
data/lib/helpers.rb CHANGED
@@ -105,6 +105,13 @@ module Backstage
105
105
  response[key] = json_url_for( object_path( value ) )
106
106
  end
107
107
  end
108
+
109
+ if object.respond_to?( :subcollections )
110
+ object.subcollections.each do |collection|
111
+ response[collection] = json_url_for( collection_path( object, collection ) )
112
+ end
113
+ end
114
+
108
115
  response
109
116
  end
110
117
 
data/spec/api_spec.rb CHANGED
@@ -41,7 +41,7 @@ module Backstage
41
41
  end
42
42
  end
43
43
 
44
- end
44
+ end
45
45
 
46
46
  describe 'with authentication enabled' do
47
47
  before(:each) do
@@ -49,7 +49,7 @@ module Backstage
49
49
  @authenticator = mock(:authenticator)
50
50
  TorqueBox::Authentication.stub(:default).and_return(@authenticator)
51
51
  end
52
-
52
+
53
53
  it "api should work with authentication" do
54
54
  @authenticator.should_receive(:authenticate).with('blah', 'pw').and_return(true)
55
55
  authorize 'blah', 'pw'
@@ -73,14 +73,14 @@ module Backstage
73
73
  ENV['REQUIRE_AUTHENTICATION'] = nil
74
74
  end
75
75
  end
76
-
76
+
77
77
  %w{ app queue topic job message_processor service pool }.each do |resource|
78
78
  klass = "backstage/#{resource}".constantize
79
79
  describe resource do
80
80
  it "should have hash attributes beyond :resource" do
81
81
  klass.to_hash_attributes.size.should > 1
82
82
  end
83
-
83
+
84
84
  describe "/#{resource.pluralize}" do
85
85
  before(:each) do
86
86
  klass.stub(:all).and_return([resource_with_mock_mbean(klass)])
@@ -131,6 +131,18 @@ module Backstage
131
131
  end
132
132
  end
133
133
  end
134
+ end
135
+
136
+ describe "/queue" do
137
+ before(:each) do
138
+ Queue.stub(:find).and_return(resource_with_mock_mbean(Queue))
139
+ get "/queue/somename", :format => 'json'
140
+ @response = JSON.parse(last_response.body, :symbolize_names => true)
141
+ end
134
142
 
143
+ it "should include a link to its messages" do
144
+ @response[:messages].should =~ %r{/queue/.*/messages.*format=json$}
145
+ end
135
146
  end
147
+
136
148
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: torquebox-backstage
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.2
5
+ version: 0.2.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tobias Crawley
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-18 00:00:00 -04:00
13
+ date: 2011-04-26 00:00:00 -04:00
14
14
  default_executable: backstage
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -75,7 +75,7 @@ dependencies:
75
75
  requirements:
76
76
  - - "="
77
77
  - !ruby/object:Gem::Version
78
- version: 1.0.0.CR1
78
+ version: 1.0.0.CR2
79
79
  requirement: *id006
80
80
  prerelease: false
81
81
  type: :runtime
@@ -188,6 +188,7 @@ extra_rdoc_files:
188
188
  - README.md
189
189
  - TODO
190
190
  files:
191
+ - CHANGELOG.md
191
192
  - Gemfile
192
193
  - Gemfile.lock
193
194
  - README.md