rboss 0.7.2 → 0.8.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/README.md CHANGED
@@ -17,7 +17,7 @@ Installation
17
17
  ### Configuration
18
18
 
19
19
  Set a RBOSS_CLI_JBOSS_HOME variable pointing to your JBoss AS home location that has jboss-cli
20
- for using rboss-cli, for using twiddle, set a TWIDDLE_HOME variable pointing to you JBoss AS
20
+ for using rboss-cli, for using twiddle, set a RBOSS_TWIDDLE_HOME variable pointing to you JBoss AS
21
21
  that has twiddle.
22
22
 
23
23
  Using rboss-cli
@@ -37,7 +37,7 @@ servers_file = "#@conf_dir/jboss-cli-servers.yaml"
37
37
  @servers_file = File.expand_path(servers_file)
38
38
  @operation = :read_resource
39
39
  save = false
40
- params[:jboss_home] = (ENV["JBOSS_HOME"] or ENV["RBOSS_CLI_JBOSS_HOME"] or Dir.pwd)
40
+ params[:jboss_home] = (ENV["RBOSS_CLI_JBOSS_HOME"] or Dir.pwd)
41
41
  params[:host] = '127.0.0.1'
42
42
  params[:port] = '9999'
43
43
 
@@ -175,5 +175,5 @@ begin
175
175
  execute_actions
176
176
 
177
177
  rescue Interrupt
178
- #Do nothing
178
+ puts Yummi::colorize("Aborted!", :red)
179
179
  end
File without changes
@@ -37,7 +37,7 @@ no_details = false
37
37
  servers_file = "#{@conf_dir}/twiddle.yaml"
38
38
  @servers_file = File.expand_path(servers_file)
39
39
  save = false
40
- params[:jboss_home] = (ENV["JBOSS_HOME"] or ENV["TWIDDLE_HOME"] or Dir.pwd)
40
+ params[:jboss_home] = (ENV["RBOSS_TWIDDLE_HOME"] or Dir.pwd)
41
41
 
42
42
  defaults = RBoss::Twiddle::Monitor::defaults
43
43
 
@@ -116,7 +116,7 @@ opts.on('--info mbean_id[:resource_name],[arguments]', Array,
116
116
  @commands[:info] = info
117
117
  end
118
118
  opts.on('--invoke mbean_id[:resource_name],method,[,args...]', Array,
119
- 'Invokes a resoruce method') do |invoke|
119
+ 'Invokes a mbean method') do |invoke|
120
120
  @commands[:invoke] = invoke
121
121
  end
122
122
  opts.on("-l", "--list", "List the mbeans mappings") do
@@ -200,5 +200,5 @@ begin
200
200
 
201
201
  execute_actions
202
202
  rescue Interrupt
203
- #Do nothing
203
+ puts Yummi::colorize("Aborted!", :red)
204
204
  end
@@ -30,26 +30,29 @@ module RBoss
30
30
  def defaults
31
31
  @@defaults ||= {
32
32
  :webapp => {
33
- :description => 'Deployed webapps',
33
+ :title => 'Deployed webapps',
34
34
  :pattern => 'jboss.web:type=Manager,host=localhost,path=/#{resource}',
35
35
  :properties => %W(activeSessions maxActive distributable maxActiveSessions
36
36
  expiredSessions rejectedSessions),
37
37
  :header => ["Active\nSessions", "Max\nSessions", "Distributable",
38
38
  "Max Active\nSession", "Expired\nSessions", "Rejected\nSessions"],
39
+ :format => {
40
+ :distributable => :boolean
41
+ },
39
42
  :scan => proc do
40
43
  query "jboss.web:type=Manager,*" do |path|
41
- path.gsub! "jboss.web:type=Manager,path=/", ""
42
- path.gsub! /,host=.+/, ''
44
+ path.gsub!("jboss.web:type=Manager,path=/", "")
45
+ path.gsub!(/,host=.+/, '')
43
46
  path
44
47
  end
45
48
  end
46
49
  },
47
50
  :web_deployment => {
48
- :description => 'Deployed webapp control',
51
+ :title => 'Deployed webapp control',
49
52
  :pattern => 'jboss.web.deployment:war=/#{resource}'
50
53
  },
51
54
  :connector => {
52
- :description => 'JBossWeb connector',
55
+ :title => 'JBossWeb connector',
53
56
  :pattern => 'jboss.web:type=ThreadPool,name=#{resource}',
54
57
  :properties => %W(maxThreads currentThreadCount currentThreadsBusy),
55
58
  :header => ['Max Threads', 'Current Threads', 'Busy Threads'],
@@ -68,36 +71,36 @@ module RBoss
68
71
  end
69
72
  },
70
73
  :cached_connection_manager => {
71
- :description => 'JBoss JCA cached connections',
74
+ :title => 'JBoss JCA cached connections',
72
75
  :pattern => 'jboss.jca:service=CachedConnectionManager',
73
76
  :properties => %W(InUseConnections),
74
77
  :header => ['In Use Connections'],
75
78
  },
76
79
  :main_deployer => {
77
- :description => 'Main Deployer',
80
+ :title => 'Main Deployer',
78
81
  :pattern => 'jboss.system:service=MainDeployer'
79
82
  },
80
83
  :engine => {
81
- :description => 'JBossWeb engine',
84
+ :title => 'JBossWeb engine',
82
85
  :pattern => 'jboss.web:type=Engine',
83
86
  :properties => %W(jvmRoute name defaultHost),
84
87
  :header => ['JVM Route', 'Name', 'Default Host'],
85
88
  },
86
89
  :log4j => {
87
- :description => 'JBoss Log4J Service',
90
+ :title => 'JBoss Log4J Service',
88
91
  :pattern => 'jboss.system:service=Logging,type=Log4jService',
89
92
  :properties => %W(DefaultJBossServerLogThreshold),
90
93
  :header => ['Default Server Log Threshold'],
91
94
  },
92
95
  :server => {
93
- :description => 'JBoss Server specifications',
96
+ :title => 'JBoss Server specifications',
94
97
  :pattern => 'jboss.system:type=Server',
95
- :properties => %W(VersionName VersionNumber Version),
98
+ :properties => %W(StartDate VersionName VersionNumber Version),
96
99
  :layout => :vertical,
97
- :header => ['Version Name', 'Version Number', 'Version'],
100
+ :header => ['Start Date', 'Version Name', 'Version Number', 'Version'],
98
101
  },
99
102
  :server_info => {
100
- :description => 'JBoss Server runtime info',
103
+ :title => 'JBoss Server runtime info',
101
104
  :pattern => 'jboss.system:type=ServerInfo',
102
105
  :properties => %W(ActiveThreadCount MaxMemory FreeMemory AvailableProcessors
103
106
  JavaVendor JavaVersion OSName OSArch),
@@ -118,18 +121,18 @@ module RBoss
118
121
  }
119
122
  },
120
123
  :server_config => {
121
- :description => 'JBoss Server configuration',
124
+ :title => 'JBoss Server configuration',
122
125
  :pattern => 'jboss.system:type=ServerConfig',
123
126
  :properties => %W(ServerName HomeDir ServerLogDir ServerHomeURL),
124
127
  :layout => :vertical,
125
128
  :header => ['Server Name', 'Home Dir', 'Log Dir', 'Home URL'],
126
129
  },
127
130
  :system_properties => {
128
- :description => 'System properties',
131
+ :title => 'System properties',
129
132
  :pattern => 'jboss:name=SystemProperties,type=Service'
130
133
  },
131
134
  :request => {
132
- :description => 'JBossWeb connector requests',
135
+ :title => 'JBossWeb connector requests',
133
136
  :pattern => 'jboss.web:type=GlobalRequestProcessor,name=#{resource}',
134
137
  :properties => %W(requestCount errorCount maxTime),
135
138
  :header => ['Requests', 'Errors', 'Max Time'],
@@ -148,7 +151,7 @@ module RBoss
148
151
  end
149
152
  },
150
153
  :datasource => {
151
- :description => 'Datasource',
154
+ :title => 'Datasource',
152
155
  :pattern => 'jboss.jca:service=ManagedConnectionPool,name=#{resource}',
153
156
  :properties => %W(MinSize MaxSize AvailableConnectionCount
154
157
  InUseConnectionCount ConnectionCount),
@@ -169,7 +172,7 @@ module RBoss
169
172
  end
170
173
  },
171
174
  :queue => {
172
- :description => 'JMS Queue',
175
+ :title => 'JMS Queue',
173
176
  :pattern => 'jboss.messaging.destination:service=Queue,name=#{resource}',
174
177
  :properties => %W(JNDIName MessageCount DeliveringCount
175
178
  ScheduledMessageCount MaxSize FullSize Clustered ConsumerCount),
@@ -182,7 +185,7 @@ module RBoss
182
185
  end
183
186
  },
184
187
  :jndi => {
185
- :description => 'JNDI View',
188
+ :title => 'JNDI View',
186
189
  :pattern => 'jboss:service=JNDIView'
187
190
  }
188
191
  }
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module RBoss
24
- VERSION = "0.7.2"
24
+ VERSION = "0.8.0"
25
25
  end
@@ -8,9 +8,9 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["Ataxexe"]
9
9
  s.email = ["ataxexe@gmail.com"]
10
10
  s.homepage = "https://github.com/ataxexe/rboss"
11
- s.summary = %q{A Ruby way to do a JBoss work!}
12
- s.description = %q{Rboss gives you an automate tool to configure a JBoss instance
13
- and a nice command line front end to use jboss-cli and twiddle}
11
+ s.summary = %q{Manage your JBoss from your command line.}
12
+ s.description = %q{Rboss gives you a set of command line tools to configure a JBoss instance
13
+ and use jboss-cli and twiddle wrapped by an elegant interface}
14
14
 
15
15
  s.rubyforge_project = "rboss"
16
16
 
data/rboss.iml CHANGED
@@ -11,7 +11,7 @@
11
11
  <orderEntry type="jdk" jdkName="RVM: ruby-1.9.3-p194" jdkType="RUBY_SDK" />
12
12
  <orderEntry type="sourceFolder" forTests="false" />
13
13
  <orderEntry type="library" scope="PROVIDED" name="bundler (v1.1.4, RVM: ruby-1.9.3-p194) [gem]" level="application" />
14
- <orderEntry type="library" scope="PROVIDED" name="yummi (v0.4.2, RVM: ruby-1.9.3-p194) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="yummi (v0.6.2, RVM: ruby-1.9.3-p194) [gem]" level="application" />
15
15
  </component>
16
16
  <component name="org.twodividedbyzero.idea.findbugs">
17
17
  <option name="_basePreferences">
data/rboss.ipr CHANGED
@@ -84,6 +84,7 @@
84
84
  <entry name="?*.dtd" />
85
85
  <entry name="?*.tld" />
86
86
  <entry name="?*.ftl" />
87
+ <entry name="trace.info" />
87
88
  </wildcardResourcePatterns>
88
89
  <annotationProcessing enabled="false" useClasspath="true" />
89
90
  </component>
@@ -109,6 +110,9 @@
109
110
  <component name="EntryPointsManager">
110
111
  <entry_points version="2.0" />
111
112
  </component>
113
+ <component name="GradleSettings">
114
+ <option name="gradleHome" value="$USER_HOME$/build/gradle" />
115
+ </component>
112
116
  <component name="GradleUISettings">
113
117
  <setting name="root" />
114
118
  </component>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rboss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.8.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,16 +9,16 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-19 00:00:00.000000000 Z
12
+ date: 2012-12-01 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: ! "Rboss gives you an automate tool to configure a JBoss instance\n and
15
- a nice command line front end to use jboss-cli and twiddle"
14
+ description: ! "Rboss gives you a set of command line tools to configure a JBoss instance\n
15
+ \ and use jboss-cli and twiddle wrapped by an elegant interface"
16
16
  email:
17
17
  - ataxexe@gmail.com
18
18
  executables:
19
- - jboss-profile
20
19
  - rboss-cli
21
- - twiddle
20
+ - rboss-profile
21
+ - rboss-twiddle
22
22
  extensions: []
23
23
  extra_rdoc_files: []
24
24
  files:
@@ -26,9 +26,9 @@ files:
26
26
  - Gemfile
27
27
  - README.md
28
28
  - Rakefile
29
- - bin/jboss-profile
30
29
  - bin/rboss-cli
31
- - bin/twiddle
30
+ - bin/rboss-profile
31
+ - bin/rboss-twiddle
32
32
  - lib/rboss.rb
33
33
  - lib/rboss/bin/command_actions.rb
34
34
  - lib/rboss/cli/invoker.rb
@@ -83,12 +83,6 @@ files:
83
83
  - rboss.gemspec
84
84
  - rboss.iml
85
85
  - rboss.ipr
86
- - test/datasource_test.rb
87
- - test/deploy_folder_test.rb
88
- - test/jbossweb_test.rb
89
- - test/mbean_test.rb
90
- - test/test_helper.rb
91
- - test/test_suite.rb
92
86
  homepage: https://github.com/ataxexe/rboss
93
87
  licenses: []
94
88
  post_install_message:
@@ -112,11 +106,5 @@ rubyforge_project: rboss
112
106
  rubygems_version: 1.8.24
113
107
  signing_key:
114
108
  specification_version: 3
115
- summary: A Ruby way to do a JBoss work!
116
- test_files:
117
- - test/datasource_test.rb
118
- - test/deploy_folder_test.rb
119
- - test/jbossweb_test.rb
120
- - test/mbean_test.rb
121
- - test/test_helper.rb
122
- - test/test_suite.rb
109
+ summary: Manage your JBoss from your command line.
110
+ test_files: []
@@ -1,211 +0,0 @@
1
- # The MIT License
2
- #
3
- # Copyright (c) 2011-2012 Marcelo Guimarães <ataxexe@gmail.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
-
23
- require_relative 'test_helper'
24
-
25
- class DatasourceTest < Test::Unit::TestCase
26
-
27
- def setup
28
- @types = %w{mysql oracle postgres}
29
- end
30
-
31
- def test_datasource_type
32
- @types.each do |type|
33
- for_test_with :all do |profile|
34
- profile.add :datasource,
35
- :type => type
36
- end
37
-
38
- for_assertions_with :all do |jboss|
39
- file = "#{jboss.profile}/deploy/#{type}-ds.xml"
40
- assert File.exists? file
41
- datasource_content = File.read file
42
- assert datasource_content[type]
43
- end
44
-
45
- do_test
46
- end
47
- end
48
-
49
- def test_datasource_naming
50
- @types.each do |type|
51
- for_test_with :all do |profile|
52
- profile.add :datasource,
53
- :type => type,
54
- :name => 'my-datasource'
55
- end
56
-
57
- for_assertions_with :all do |jboss|
58
- file = "#{jboss.profile}/deploy/my-datasource-ds.xml"
59
- assert File.exists? file
60
- datasource_content = File.read file
61
- assert datasource_content[type]
62
- end
63
-
64
- do_test
65
- end
66
- end
67
-
68
- def test_datasource_folder_inside_installation
69
- @types.each do |type|
70
- for_test_with :all do |profile|
71
- profile.add :deploy_folder, 'deploy/datasources'
72
-
73
- profile.add :datasource,
74
- :type => type,
75
- :folder => 'deploy/datasources'
76
- end
77
-
78
- for_assertions_with :all do |jboss|
79
- file = "#{jboss.profile}/deploy/datasources/#{type}-ds.xml"
80
- assert File.exists? file
81
- datasource_content = File.read file
82
- assert datasource_content[type]
83
- end
84
-
85
- do_test
86
- end
87
- end
88
-
89
- def test_datasource_folder_outside_installation
90
- @types.each do |type|
91
- for_test_with :all do |profile|
92
- profile.add :deploy_folder, '/tmp/datasources'
93
-
94
- profile.add :datasource,
95
- :type => type,
96
- :folder => '/tmp/datasources'
97
- end
98
-
99
- for_assertions_with :all do |jboss|
100
- file = "/tmp/datasources/#{type}-ds.xml"
101
- assert File.exists? file
102
- datasource_content = File.read file
103
- assert datasource_content[type]
104
-
105
- `rm -rf /tmp/datasources`
106
- end
107
-
108
- do_test
109
- end
110
- end
111
-
112
- def test_datasource_attributes
113
- @types.each do |type|
114
- for_test_with :all do |profile|
115
-
116
- profile.add :datasource,
117
- :type => type,
118
- :attributes => {
119
- :jndi_name => "#{type}Datasource",
120
- :user_name => "#{type}_user",
121
- :password => "#{type}_password",
122
- :connection_url => "#{type}_connection",
123
- :driver_class => "#{type}_class"
124
- }
125
- end
126
-
127
- for_assertions_with :all do |jboss|
128
- file = "#{jboss.profile}/deploy/#{type}-ds.xml"
129
- xml = REXML::Document::new File::new(file)
130
-
131
- assert_tag xml, "//jndi-name", "#{type}Datasource", "local-tx-datasource"
132
- assert_tag xml, "//user-name", "#{type}_user", "local-tx-datasource"
133
- assert_tag xml, "//password", "#{type}_password", "local-tx-datasource"
134
- assert_tag xml, "//connection-url", "#{type}_connection", "local-tx-datasource"
135
- assert_tag xml, "//driver-class", "#{type}_class", "local-tx-datasource"
136
- end
137
-
138
- do_test
139
- end
140
- end
141
-
142
- def test_new_datasource_attributes
143
- @types.each do |type|
144
- for_test_with :all do |profile|
145
-
146
- profile.add :datasource,
147
- :type => type,
148
- :attributes => {
149
- :min_pool_size => 10,
150
- :max_pool_size => 50,
151
- :use_java_context => true
152
- }
153
- end
154
-
155
- for_assertions_with :all do |jboss|
156
- file = "#{jboss.profile}/deploy/#{type}-ds.xml"
157
- xml = REXML::Document::new File::new(file)
158
-
159
- assert_tag xml, "//min-pool-size", 10, "local-tx-datasource"
160
- assert_tag xml, "//max-pool-size", 50, "local-tx-datasource"
161
- end
162
-
163
- do_test
164
- end
165
- end
166
-
167
- def test_datasource_encryption
168
- @types.each do |type|
169
- for_test_with :all do |profile|
170
-
171
- profile.add :datasource,
172
- :type => type,
173
- :encrypt => true,
174
- :attributes => {
175
- :jndi_name => "MyDatasource",
176
- :user_name => "user-name",
177
- :password => "password"
178
- }
179
- end
180
-
181
- for_assertions_with :all do |jboss|
182
- file = "#{jboss.profile}/deploy/#{type}-ds.xml"
183
- xml = REXML::Document::new File::new(file)
184
-
185
- assert XPath::first(xml, "//user-name").nil?
186
- assert XPath::first(xml, "//password").nil?
187
-
188
- assert_tag xml, "//security-domain", type, "local-tx-datasource"
189
-
190
- xml = REXML::Document::new File::new("#{jboss.profile}/deploy/#{type}.login-module.xml")
191
-
192
- application_policy = XPath::first xml, "//application-policy[@name='#{type}']"
193
- assert !application_policy.nil?
194
- assert application_policy.parent.name == "policy"
195
-
196
- assert_tag application_policy, ".//module-option[@name='username']", "user-name", "login-module"
197
- assert_tag application_policy, ".//module-option[@name='password']", "5dfc52b51bd35553df8592078de921bc", "login-module"
198
- assert_tag application_policy, ".//module-option[@name='managedConnectionFactoryName']", "jboss.jca:name=MyDatasource,service=LocalTxCM", "login-module"
199
- end
200
-
201
- do_test
202
- end
203
- end
204
-
205
- def assert_tag xml, path, value, parent_name = nil
206
- tag = XPath::first xml, path
207
- assert tag.text.strip == value.to_s
208
- assert tag.parent.name == parent_name if parent_name
209
- end
210
-
211
- end
@@ -1,126 +0,0 @@
1
- # The MIT License
2
- #
3
- # Copyright (c) 2011-2012 Marcelo Guimarães <ataxexe@gmail.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
-
23
- require_relative 'test_helper'
24
-
25
- class DeployFolderTest < Test::Unit::TestCase
26
-
27
- def test_folder_inside_deploy
28
- for_test_with :all do |profile|
29
- profile.add :deploy_folder, 'deploy/rboss-deploy'
30
- profile.add :deploy_folder, 'deploy/rboss/deploy'
31
- end
32
-
33
- for_assertions_with :all do |jboss|
34
- assert(File.exists? "#{jboss.profile}/deploy/rboss-deploy")
35
- assert(File.directory? "#{jboss.profile}/deploy/rboss-deploy")
36
- assert(File.exists? "#{jboss.profile}/deploy/rboss/deploy")
37
- assert(File.directory? "#{jboss.profile}/deploy/rboss/deploy")
38
- end
39
-
40
- do_test
41
- end
42
-
43
- def test_folder_outside_deploy
44
- for_test_with :all do |profile|
45
- profile.add :deploy_folder, 'rboss-deploy'
46
- profile.add :deploy_folder, 'rboss/deploy'
47
- end
48
-
49
- for_assertions_with :all do |jboss|
50
- assert(File.exists? "#{jboss.profile}/rboss-deploy")
51
- assert(File.directory? "#{jboss.profile}/rboss-deploy")
52
- assert(File.exists? "#{jboss.profile}/rboss/deploy")
53
- assert(File.directory? "#{jboss.profile}/rboss/deploy")
54
-
55
- check_profile_xml "${jboss.server.home.url}rboss-deploy", "${jboss.server.home.url}rboss/deploy"
56
- check_vfs_xml "${jboss.server.home.url}rboss-deploy", "${jboss.server.home.url}rboss/deploy"
57
- end
58
-
59
- for_assertions_with :org, 6.0 do |jboss|
60
- assert(File.exists? "#{jboss.profile}/rboss-deploy")
61
- assert(File.directory? "#{jboss.profile}/rboss-deploy")
62
- assert(File.exists? "#{jboss.profile}/rboss/deploy")
63
- assert(File.directory? "#{jboss.profile}/rboss/deploy")
64
-
65
- check_profile_xml "${jboss.server.home.url}rboss-deploy", "${jboss.server.home.url}rboss/deploy"
66
- end
67
-
68
- do_test
69
- end
70
-
71
- def test_folder_outside_jboss
72
- for_test_with :all do |profile|
73
- profile.add :deploy_folder, '/tmp/rboss-deploy'
74
- profile.add :deploy_folder, '/tmp/rboss/deploy'
75
- end
76
-
77
- for_assertions_with :all do |jboss|
78
- assert(File.exists? "/tmp/rboss-deploy")
79
- assert(File.directory? "/tmp/rboss-deploy")
80
- assert(File.exists? "/tmp/rboss/deploy")
81
- assert(File.directory? "/tmp/rboss/deploy")
82
-
83
- check_profile_xml 'file:///tmp/rboss-deploy', 'file:///tmp/rboss/deploy'
84
- check_vfs_xml 'file:///tmp/rboss-deploy', 'file:///tmp/rboss/deploy'
85
- end
86
-
87
- for_assertions_with :org, 6.0 do |jboss|
88
- assert(File.exists? "/tmp/rboss-deploy")
89
- assert(File.directory? "/tmp/rboss-deploy")
90
- assert(File.exists? "/tmp/rboss/deploy")
91
- assert(File.directory? "/tmp/rboss/deploy")
92
-
93
- check_profile_xml 'file:///tmp/rboss-deploy', 'file:///tmp/rboss/deploy'
94
- end
95
-
96
- do_test
97
-
98
- `rm -rf /tmp/rboss*`
99
- end
100
-
101
- def check_profile_xml *names
102
- xml = REXML::Document::new File::new("#{@jboss.profile}/conf/bootstrap/profile.xml")
103
- element = XPath.first xml, "//property[@name='applicationURIs']"
104
- element = XPath.first element, "//list[@elementClass='java.net.URI']"
105
- element.each do |el|
106
- names.delete el.text.strip if el.respond_to? :text
107
- end
108
- assert(names.empty?)
109
- end
110
-
111
- def check_vfs_xml *names
112
- xml = REXML::Document::new File::new("#{@jboss.profile}/conf/bootstrap/vfs.xml")
113
- element = XPath.first xml, "//property[@name='permanentRoots']"
114
- element = XPath.first element, "//map[@keyClass='java.net.URL']"
115
- XPath.each element, "//key" do |el|
116
- if el.respond_to? :text
117
- names.delete el.text.strip
118
- value = XPath.first el.parent, "//value"
119
- inject = XPath.first value, "//inject"
120
- assert(inject.attributes["bean"] == "VfsNamesExceptionHandler")
121
- end
122
- end
123
- assert(names.empty?)
124
- end
125
-
126
- end
@@ -1,101 +0,0 @@
1
- # The MIT License
2
- #
3
- # Copyright (c) 2011-2012 Marcelo Guimarães <ataxexe@gmail.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
-
23
- require_relative 'test_helper'
24
-
25
- class JBossWebTest < Test::Unit::TestCase
26
-
27
- def test_http_connector
28
- for_test_with :all do |profile|
29
- profile.add :jbossweb,
30
- :connectors => {
31
- :http => {
32
- :max_threads => 600
33
- }
34
- }
35
- end
36
-
37
- for_assertions_with :all do |jboss|
38
- xml = xml(jboss)
39
- max_threads = XPath::first xml, "//Connector[@port='8080'][@protocol='HTTP/1.1'][@maxThreads='600']"
40
- assert max_threads
41
- end
42
-
43
- do_test
44
- end
45
-
46
- def test_https_connector
47
- for_test_with :all do |profile|
48
- profile.add :jbossweb,
49
- :connectors => {
50
- :https => {
51
- :max_threads => 600
52
- }
53
- }
54
- end
55
-
56
- for_assertions_with :all do |jboss|
57
- xml = xml(jboss)
58
- max_threads = XPath::first xml, "//Connector[@port='8443'][@protocol='HTTP/1.1'][@maxThreads='600']"
59
- assert max_threads
60
- end
61
-
62
- do_test
63
- end
64
-
65
- def test_ajp_connector
66
- for_test_with :all do |profile|
67
- profile.add :jbossweb,
68
- :connectors => {
69
- :ajp => {
70
- :max_threads => 600
71
- }
72
- }
73
- end
74
-
75
- for_assertions_with :all do |jboss|
76
- xml = xml(jboss)
77
- max_threads = XPath::first xml, "//Connector[@port='8009'][@protocol='AJP/1.3'][@maxThreads='600']"
78
- assert max_threads
79
- end
80
-
81
- do_test
82
- end
83
-
84
-
85
- def test_engine
86
- for_test_with :all do |profile|
87
- profile.add :jbossweb,
88
- :jvm_route => 'route'
89
- end
90
- for_assertions_with :all do |jboss|
91
- xml = xml(jboss)
92
- jvm_route = XPath::first xml, "//Engine[@name='jboss.web'][@jvmRoute='route']"
93
- assert jvm_route
94
- end
95
- end
96
-
97
- def xml(jboss)
98
- REXML::Document::new File::new("#{jboss.profile}/deploy/jbossweb.sar/server.xml")
99
- end
100
-
101
- end
@@ -1,55 +0,0 @@
1
- # The MIT License
2
- #
3
- # Copyright (c) 2011-2012 Marcelo Guimarães <ataxexe@gmail.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
-
23
- require 'test/unit'
24
- require_relative '../lib/rboss'
25
-
26
- class MBeanTest < Test::Unit::TestCase
27
-
28
- def twiddle
29
- twiddle = Object.new
30
-
31
- def twiddle.execute command, *args
32
- "#{command} #{args.join " "}".strip
33
- end
34
-
35
- twiddle
36
- end
37
-
38
- def test_pattern_with_resource
39
- mbean = JBoss::MBean::new :pattern => 'query=/#{resource}', :twiddle => twiddle
40
- mbean.resource= "my_resource"
41
- assert_equal "get query=/my_resource my_property", mbean[:my_property]
42
- end
43
-
44
- def test_pattern_without_resource
45
- mbean = JBoss::MBean::new :pattern => 'query=/resource', :twiddle => twiddle
46
- assert_equal "get query=/resource my_property", mbean[:my_property]
47
- end
48
-
49
- def test_invoke
50
- mbean = JBoss::MBean::new :pattern => 'jboss.system:type=Server', :twiddle => twiddle
51
- assert_equal "invoke jboss.system:type=Server shutdown", mbean.invoke(:shutdown)
52
- assert_equal "invoke jboss.system:type=Server traceInstructions true", mbean.invoke(:traceInstructions, true)
53
- end
54
-
55
- end
@@ -1,128 +0,0 @@
1
- # The MIT License
2
- #
3
- # Copyright (c) 2011-2012 Marcelo Guimarães <ataxexe@gmail.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
-
23
- require 'test/unit'
24
- require 'logger'
25
- require 'rexml/document'
26
-
27
- require_relative '../lib/rboss'
28
- require_relative '../lib/rboss/file_processor'
29
-
30
- include JBoss
31
- include REXML
32
-
33
- module TestHelper
34
-
35
- def all
36
- @all ||= {
37
- :org => [5.1],
38
- :eap => [5.1],
39
- :soa_p => 5
40
- }
41
- @all
42
- end
43
-
44
- def jboss_dir
45
- ENV["JBOSS_DIR"] or File.expand_path "~/jboss"
46
- end
47
-
48
- def for_test_with type, version = nil, &block
49
- @test_blocks ||= {}
50
- if type == :all
51
- all.each do |key, value|
52
- set_block key, value, :configure, block
53
- end
54
- else
55
- set_block type, version, :configure, block
56
- end
57
- end
58
-
59
- def for_assertions_with type, version = nil, &block
60
- @assertion_blocks ||= {}
61
- if type == :all
62
- all.each do |key, value|
63
- set_block key, value, :assertion, block
64
- end
65
- else
66
- set_block type, version, :assertion, block
67
- end
68
- end
69
-
70
- def do_test
71
- @test_blocks.each do |type, versions|
72
- versions.each do |version, blocks|
73
- do_test_with type, version, blocks
74
- end
75
- end
76
- end
77
-
78
- def do_test_with type, version, blocks
79
- map = {
80
- :eap => "#{jboss_dir}/eap/jboss-eap-#{version}/jboss-as",
81
- :epp => "#{jboss_dir}/epp/jboss-epp-#{version}/jboss-as",
82
- :soa_p => "#{jboss_dir}/soa-p/jboss-soa-p-#{version}/jboss-as",
83
- :org => "#{jboss_dir}/org/jboss-#{version}"
84
- }
85
- return unless File.exist? map[type]
86
- @logger = Logger::new STDOUT
87
- @logger.level = Logger::WARN
88
- @jboss_profile = Profile::new :jboss_home => map[type],
89
- :type => type,
90
- :version => version,
91
- :base_profile => :all,
92
- :profile => :rboss,
93
- :logger => @logger
94
- @jboss = @jboss_profile.jboss
95
- block = blocks[:configure]
96
- if block
97
- block.call @jboss_profile
98
- puts "Creating #{type} #{version}"
99
- @jboss_profile.create
100
- puts "Running assertion block"
101
- blocks[:assertion].call @jboss
102
- end
103
- end
104
-
105
- def create_file_processor
106
- RBoss::FileProcessor::new :logger => @logger, :var => @jboss
107
- end
108
-
109
- private
110
-
111
- def set_block(type, version, key, block)
112
- @test_blocks[type] ||= {}
113
- if version.kind_of? Array
114
- version.each do |v|
115
- @test_blocks[type][v] ||= {}
116
- @test_blocks[type][v][key] = block
117
- end
118
- else
119
- @test_blocks[type][version] ||= {}
120
- @test_blocks[type][version][key] = block
121
- end
122
- end
123
-
124
- end
125
-
126
- class Test::Unit::TestCase
127
- include TestHelper
128
- end
@@ -1,36 +0,0 @@
1
- # The MIT License
2
- #
3
- # Copyright (c) 2011-2012 Marcelo Guimarães <ataxexe@gmail.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
-
23
- require 'test/unit'
24
- require 'test/unit/testsuite'
25
- require_relative 'deploy_folder_test'
26
- require_relative 'datasource_test'
27
- require_relative 'jbossweb_test'
28
- require_relative 'mbean_test'
29
-
30
- class TestSuite < Test::Unit::TestSuite
31
-
32
- def initialize
33
- self << DeployFolderTest << DatasourceTest << JBossWebTest << MBeanTest
34
- end
35
-
36
- end