rboss 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +18 -2
- data/bin/jboss-profile +27 -7
- data/bin/twiddle +7 -12
- data/lib/rboss/components/component.rb +6 -0
- data/lib/rboss/components/jbossweb.rb +3 -1
- data/lib/rboss/components/restore_slimming.rb +46 -0
- data/lib/rboss/components/run_conf.rb +1 -1
- data/lib/rboss/components/slimming.rb +44 -61
- data/lib/rboss/components/slimming.yaml +110 -0
- data/lib/rboss/jboss_path.rb +4 -1
- data/lib/rboss/jboss_profile.rb +10 -4
- data/lib/rboss/twiddle/twiddle.rb +18 -1
- data/lib/rboss/version.rb +1 -1
- data/test/jbossweb_test.rb +101 -0
- data/test/mbean_test.rb +5 -3
- data/test/test_helper.rb +11 -7
- data/test/test_suite.rb +2 -1
- metadata +6 -2
data/README.md
CHANGED
@@ -220,15 +220,31 @@ Use an array with the services to remove, the current supported are:
|
|
220
220
|
* Admin Console => :admin_console
|
221
221
|
* Web Console => :web_console
|
222
222
|
* Mail Service => :mail
|
223
|
-
*
|
223
|
+
* BeanShell => :bean_shell
|
224
224
|
* Hot Deploy => :hot_deploy
|
225
|
-
*
|
225
|
+
* UDDI => :uddi
|
226
226
|
* UUID Key Generator => :key_generator
|
227
227
|
* Scheduling => :scheduling
|
228
228
|
* JMX Console => :jmx_console
|
229
229
|
* JBoss WS => :jboss_ws
|
230
230
|
* JMX Remoting => :jmx_remoting
|
231
231
|
* ROOT Page => :root_page
|
232
|
+
* Management => :management
|
233
|
+
* IIOP => :iiop
|
234
|
+
* JBoss Web => :jboss_web
|
235
|
+
* SNMP => :snmp
|
236
|
+
* Profile Service => :profile
|
237
|
+
* EJB3 => :ejb3
|
238
|
+
* EJB2 => :ejb2
|
239
|
+
* JMX Invoker => :jmx_invoker
|
240
|
+
* HA HTTP Invoker => :ha_http_invoker
|
241
|
+
* Legacy Invoker => :legacy_invoker
|
242
|
+
* Transaction => :transaction
|
243
|
+
* Remoting => :remoting
|
244
|
+
* Properties Service => :properties
|
245
|
+
* Database/Datasource => :database
|
246
|
+
* JSR-88 => :jsr88
|
247
|
+
* XNIO => :xnio
|
232
248
|
|
233
249
|
Any slimmed service will be removed logically by using a ".rej" suffix in the files/directories.
|
234
250
|
|
data/bin/jboss-profile
CHANGED
@@ -38,7 +38,7 @@ end
|
|
38
38
|
opts.on('-t', '--type TYPE', 'Defines the JBoss Type (org, eap, soa_p, epp)') do |type|
|
39
39
|
params[:type] = type.to_sym
|
40
40
|
end
|
41
|
-
opts.on('-
|
41
|
+
opts.on('-n', '--version VERSION', 'Defines the JBoss version (5, 6, 5.1, ...)') do |version|
|
42
42
|
params[:version] = version
|
43
43
|
end
|
44
44
|
opts.on('-b', '--base-profile PROFILE', 'Defines the base profile') do |profile|
|
@@ -61,13 +61,25 @@ opts.on('-c', '--config-file FILE', 'Defines the configuration file for the inst
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
64
|
-
opts.on('-d', '--debug', '--verbose', 'Displays shell commands') do
|
65
|
-
include FileUtils::Verbose
|
66
|
-
params[:log_level] = Logger::DEBUG
|
67
|
-
end
|
68
64
|
opts.on("--encrypt PASSWORD", "Encrypts the given password for using with a SecureIdentityLoginModule") do |password|
|
69
65
|
params[:encrypt] = password
|
70
66
|
end
|
67
|
+
opts.on("--slim SERVICES", "--slimming SERVICES", Array, "Slim the desired JBoss profile") do |services|
|
68
|
+
params[:slimming] = services
|
69
|
+
end
|
70
|
+
opts.on("--restore SERVICES", Array, "Restores slimmed services in the desired JBoss profile") do |services|
|
71
|
+
params[:restore] = services
|
72
|
+
create = false
|
73
|
+
end
|
74
|
+
opts.on("--this", "Defines the current dir as the profile folder and update mode") do
|
75
|
+
params[:jboss_home] = File.dirname(File.dirname(Dir.pwd))
|
76
|
+
params[:profile] = Dir.pwd.split('/')[-1]
|
77
|
+
create = false
|
78
|
+
end
|
79
|
+
opts.on('-v', '--verbose', 'Displays shell commands') do
|
80
|
+
include FileUtils::Verbose
|
81
|
+
params[:log_level] = Logger::DEBUG
|
82
|
+
end
|
71
83
|
opts.on("-h", "--help", "Shows this help message") { puts opts; exit }
|
72
84
|
opts.parse!(ARGV) rescue abort 'Invalid Option! Use --help or -h for usage help.'
|
73
85
|
|
@@ -79,8 +91,16 @@ end
|
|
79
91
|
params[:jboss_home] ||= Dir.pwd unless ENV["JBOSS_HOME"]
|
80
92
|
profile = JBoss::Profile::new params
|
81
93
|
|
94
|
+
if params[:slimming]
|
95
|
+
profile.slim *params[:slimming]
|
96
|
+
end
|
97
|
+
|
98
|
+
if params[:restore]
|
99
|
+
profile.add :restore, *params[:restore]
|
100
|
+
end
|
101
|
+
|
82
102
|
if params[:encrypt]
|
83
|
-
puts "Encrypted password: " + profile.jboss.encrypt(params
|
103
|
+
puts "Encrypted password: " + profile.jboss.encrypt(params[:encrypt])
|
84
104
|
exit
|
85
105
|
end
|
86
106
|
|
@@ -88,7 +108,7 @@ if config
|
|
88
108
|
config.each do |var|
|
89
109
|
if var.is_a? Hash
|
90
110
|
var.each do |key, value|
|
91
|
-
key = key.to_sym if key.is_a? String
|
111
|
+
key = key.gsub(/-/, '_').to_sym if key.is_a? String
|
92
112
|
profile.add key, value
|
93
113
|
end
|
94
114
|
else
|
data/bin/twiddle
CHANGED
@@ -24,6 +24,7 @@
|
|
24
24
|
|
25
25
|
require_relative '../lib/rboss'
|
26
26
|
require 'optparse'
|
27
|
+
require 'logger'
|
27
28
|
require 'yaml'
|
28
29
|
require 'fileutils'
|
29
30
|
|
@@ -131,6 +132,9 @@ end
|
|
131
132
|
opts.on('-p', '--password PASSWORD', 'Defines the JMX Password') do |password|
|
132
133
|
params[:password] = password
|
133
134
|
end
|
135
|
+
opts.on('-v', '--verbose', 'Shows the twiddle commands before execution') do
|
136
|
+
params[:log_level] = Logger::DEBUG
|
137
|
+
end
|
134
138
|
opts.on("-h", "--help", "Shows this help message") do
|
135
139
|
puts opts; exit
|
136
140
|
end
|
@@ -139,8 +143,6 @@ opts.parse!(ARGV) rescue abort 'Invalid Option! Use --help or -h for usage help.
|
|
139
143
|
twiddle = JBoss::Twiddle::Invoker::new params
|
140
144
|
monitor = twiddle.monitor
|
141
145
|
|
142
|
-
no_process = mbeans.empty? and commands.empty?
|
143
|
-
|
144
146
|
if save
|
145
147
|
config = load_yaml
|
146
148
|
config[save] ||= {}
|
@@ -154,15 +156,7 @@ if save
|
|
154
156
|
f = File.open(@servers_file, 'w')
|
155
157
|
YAML::dump(config, f)
|
156
158
|
f.close
|
157
|
-
|
158
|
-
puts "Configuration saved!"
|
159
|
-
exit
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
if no_process
|
164
|
-
puts opts
|
165
|
-
exit
|
159
|
+
puts "Configuration saved!"
|
166
160
|
end
|
167
161
|
|
168
162
|
def extract resource
|
@@ -177,6 +171,8 @@ def normalize args
|
|
177
171
|
end
|
178
172
|
end
|
179
173
|
|
174
|
+
puts opts if mbeans.empty? and commands.empty?
|
175
|
+
|
180
176
|
if commands[:set]
|
181
177
|
array = commands[:set]
|
182
178
|
raise "Wrong number of arguments" if array.size != 3
|
@@ -219,7 +215,6 @@ if commands[:info]
|
|
219
215
|
:args => normalize(array[1..-1])
|
220
216
|
end
|
221
217
|
|
222
|
-
|
223
218
|
mbeans.each do |mbean_id, resources|
|
224
219
|
puts " - #{defaults[mbean_id][:description]}"
|
225
220
|
if resources.is_a? TrueClass
|
@@ -24,6 +24,8 @@ require_relative "../file_processor"
|
|
24
24
|
require_relative "../jboss_path"
|
25
25
|
require_relative "../utils"
|
26
26
|
|
27
|
+
require 'yaml'
|
28
|
+
|
27
29
|
module JBoss
|
28
30
|
|
29
31
|
# A base helper module for JBoss Components
|
@@ -48,5 +50,9 @@ module JBoss
|
|
48
50
|
FileProcessor::new :logger => @logger, :var => @jboss
|
49
51
|
end
|
50
52
|
|
53
|
+
def load_yaml resource
|
54
|
+
YAML::load_file File::join(File.dirname(__FILE__), "#{resource}.yaml")
|
55
|
+
end
|
56
|
+
|
51
57
|
end
|
52
58
|
end
|
@@ -27,7 +27,7 @@ require "rexml/document"
|
|
27
27
|
include REXML
|
28
28
|
|
29
29
|
module JBoss
|
30
|
-
class
|
30
|
+
class JBossWeb
|
31
31
|
include Component
|
32
32
|
|
33
33
|
def defaults
|
@@ -53,7 +53,9 @@ module JBoss
|
|
53
53
|
:https => {
|
54
54
|
:addres => "${jboss.bind.address}",
|
55
55
|
:port => 8443,
|
56
|
+
:protocol => "HTTP/1.1",
|
56
57
|
:scheme => "https",
|
58
|
+
'SSLEnabled' => true,
|
57
59
|
:secure => true,
|
58
60
|
:ssl_protocol => "TLS",
|
59
61
|
:client_auth => false,
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# The MIT License
|
2
|
+
#
|
3
|
+
# Copyright (c) 2011 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 'slimming'
|
24
|
+
|
25
|
+
module JBoss
|
26
|
+
# A class for restore slimmed services in a JBoss profile
|
27
|
+
#
|
28
|
+
# Configuration:
|
29
|
+
#
|
30
|
+
# See the JBoss::Slimming class for supported services
|
31
|
+
#
|
32
|
+
# author: Marcelo Guimarães <ataxexe@gmail.com>
|
33
|
+
class Restore < JBoss::Slimming
|
34
|
+
|
35
|
+
def log service
|
36
|
+
@logger.info "Enabling #{service}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def handle file
|
40
|
+
file = "#{@jboss.profile}/" + file unless file.start_with? '/'
|
41
|
+
mv(file + ".rej", file) if File.exist?(file + ".rej")
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -77,7 +77,7 @@ module JBoss
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def parse_config
|
80
|
-
map =
|
80
|
+
map = load_yaml "run_conf"
|
81
81
|
|
82
82
|
(@config.find_all { |key, value| map.has_key? key.to_s }).each do |key, value|
|
83
83
|
@jvm_args << "-D#{map[key.to_s]}=#{value}"
|
@@ -32,91 +32,74 @@ module JBoss
|
|
32
32
|
# Admin Console => :admin_console
|
33
33
|
# Web Console => :web_console
|
34
34
|
# Mail Service => :mail
|
35
|
-
#
|
35
|
+
# BeanShell => :bean_shell
|
36
36
|
# Hot Deploy => :hot_deploy
|
37
|
-
#
|
37
|
+
# UDDI => :uddi
|
38
38
|
# UUID Key Generator => :key_generator
|
39
39
|
# Scheduling => :scheduling
|
40
40
|
# JMX Console => :jmx_console
|
41
41
|
# JBoss WS => :jboss_ws
|
42
42
|
# JMX Remoting => :jmx_remoting
|
43
43
|
# ROOT Page => :root_page
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
44
|
+
# Management => :management
|
45
|
+
# IIOP => :iiop
|
46
|
+
# JBoss Web => :jboss_web
|
47
|
+
# SNMP => :snmp
|
48
|
+
# Profile Service => :profile
|
49
|
+
# EJB3 => :ejb3
|
50
|
+
# EJB2 => :ejb2
|
51
|
+
# JMX Invoker => :jmx_invoker
|
52
|
+
# HA HTTP Invoker => :ha_http_invoker
|
53
|
+
# Legacy Invoker => :legacy_invoker
|
54
|
+
# Transaction => :transaction
|
55
|
+
# Remoting => :remoting
|
56
|
+
# Properties Service => :properties
|
57
|
+
# Database/Datasource => :database
|
58
|
+
# JSR-88 => :jsr88
|
59
|
+
# XNIO => :xnio
|
47
60
|
#
|
48
61
|
# author: Marcelo Guimarães <ataxexe@gmail.com>
|
49
62
|
class Slimming
|
50
63
|
include Component, FileUtils
|
51
64
|
|
52
65
|
def configure services_to_remove
|
53
|
-
@services_to_remove = services_to_remove
|
66
|
+
@services_to_remove = services_to_remove.is_a?(Array) ? services_to_remove : [services_to_remove]
|
67
|
+
@mapping = {}
|
68
|
+
load_yaml('slimming').each do |key, values|
|
69
|
+
@mapping[key.to_sym] = values
|
70
|
+
end
|
54
71
|
end
|
55
72
|
|
56
73
|
def process
|
57
74
|
@services_to_remove.each do |service|
|
58
|
-
|
59
|
-
|
60
|
-
self.send message
|
75
|
+
log service
|
76
|
+
slim service
|
61
77
|
end
|
62
78
|
end
|
63
79
|
|
64
|
-
def
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
reject("#{@jboss.profile}/deploy/mail-service.xml")
|
79
|
-
end
|
80
|
-
|
81
|
-
def remove_scheduling
|
82
|
-
reject("#{@jboss.profile}/deploy/scheduler-manager-service.xml")
|
83
|
-
reject("#{@jboss.profile}/deploy/scheduler-service.xml")
|
84
|
-
end
|
85
|
-
|
86
|
-
def remove_bsh_deployer
|
87
|
-
reject("#{@jboss.profile}/deployers/bsh.deployer")
|
88
|
-
end
|
89
|
-
|
90
|
-
def remove_jboss_ws
|
91
|
-
reject("#{@jboss.profile}/conf/jax-ws-catalog.xml")
|
92
|
-
reject("#{@jboss.profile}/conf/props/jbossws-users.properties")
|
93
|
-
reject("#{@jboss.profile}/conf/props/jbossws-roles.properties")
|
94
|
-
reject("#{@jboss.profile}/deploy/jbossws.sar")
|
95
|
-
reject("#{@jboss.profile}/deployers/jbossws.deployer")
|
96
|
-
end
|
97
|
-
|
98
|
-
def remove_jmx_console
|
99
|
-
reject("#{@jboss.profile}/deploy/jmx-console.war")
|
100
|
-
end
|
101
|
-
|
102
|
-
def remove_admin_console
|
103
|
-
reject("#{@jboss.profile}/deploy/admin-console.war")
|
104
|
-
end
|
105
|
-
|
106
|
-
def remove_web_console
|
107
|
-
reject("#{@jboss.profile}/deploy/management")
|
108
|
-
end
|
109
|
-
|
110
|
-
def remove_jmx_remoting
|
111
|
-
reject("#{@jboss.profile}/deploy/jmx-remoting.sar")
|
80
|
+
def slim service
|
81
|
+
sym = service.to_s.gsub(/-/, '_').to_sym
|
82
|
+
entry = @mapping[sym]
|
83
|
+
method = "remove_#{service}".to_sym
|
84
|
+
if respond_to? method
|
85
|
+
self.send method
|
86
|
+
elsif entry
|
87
|
+
entry.each do |file|
|
88
|
+
handle file if file.is_a? String
|
89
|
+
slim file if file.is_a? Symbol
|
90
|
+
end
|
91
|
+
else
|
92
|
+
raise "Unrecognized service: #{service}"
|
93
|
+
end
|
112
94
|
end
|
113
95
|
|
114
|
-
def
|
115
|
-
|
96
|
+
def log service
|
97
|
+
@logger.info "Disabling #{service}"
|
116
98
|
end
|
117
99
|
|
118
|
-
def
|
119
|
-
|
100
|
+
def handle file
|
101
|
+
file = "#{@jboss.profile}/" + file unless file.start_with? '/'
|
102
|
+
mv(file, file + ".rej") if File.exist? file
|
120
103
|
end
|
121
104
|
|
122
105
|
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
hot_deploy:
|
2
|
+
- deploy/hdscanner-jboss-beans.xml
|
3
|
+
|
4
|
+
uddi:
|
5
|
+
- deploy/juddi-service.sar
|
6
|
+
|
7
|
+
key_generator:
|
8
|
+
- deploy/uuid-key-generator.sar
|
9
|
+
|
10
|
+
mail:
|
11
|
+
- deploy/mail-ra.rar
|
12
|
+
- deploy/mail-service.xml
|
13
|
+
|
14
|
+
scheduling:
|
15
|
+
- deploy/scheduler-manager-service.xml
|
16
|
+
- deploy/scheduler-service.xml
|
17
|
+
|
18
|
+
bean_shell:
|
19
|
+
- deployers/bsh.deployer
|
20
|
+
|
21
|
+
jboss_ws:
|
22
|
+
- conf/jax-ws-catalog.xml
|
23
|
+
- conf/props/jbossws-users.properties
|
24
|
+
- conf/props/jbossws-roles.properties
|
25
|
+
- deploy/jbossws.sar
|
26
|
+
- deployers/jbossws.deployer
|
27
|
+
|
28
|
+
jmx_console:
|
29
|
+
- deploy/jmx-console.war
|
30
|
+
|
31
|
+
admin_console:
|
32
|
+
- deploy/admin-console.war
|
33
|
+
|
34
|
+
web_console:
|
35
|
+
- deploy/management
|
36
|
+
|
37
|
+
jmx_remoting:
|
38
|
+
- deploy/jmx-remoting.sar
|
39
|
+
|
40
|
+
root_page:
|
41
|
+
- deploy/ROOT.war
|
42
|
+
|
43
|
+
management:
|
44
|
+
- :admin_console
|
45
|
+
- :web_console
|
46
|
+
- :root_page
|
47
|
+
- :jmx_console
|
48
|
+
- deploy/monitoring-service.xml
|
49
|
+
|
50
|
+
iiop:
|
51
|
+
- deploy/iiop-service.xml
|
52
|
+
|
53
|
+
jboss_web:
|
54
|
+
- deploy/jbossweb.sar
|
55
|
+
- deployers/jbossweb.deployer
|
56
|
+
|
57
|
+
snmp:
|
58
|
+
- deploy/snmp-adaptor.sar
|
59
|
+
|
60
|
+
profile:
|
61
|
+
- deploy/profileservice-jboss-beans.xml
|
62
|
+
|
63
|
+
ejb3:
|
64
|
+
|
65
|
+
- deploy/ejb3-connectors-jboss-beans.xml
|
66
|
+
- deploy/ejb3-container-jboss-beans.xml
|
67
|
+
- deploy/ejb3-interceptors-aop.xml
|
68
|
+
- deploy/ejb3-timerservice-jboss-beans.xml
|
69
|
+
- deploy/quartz-ra.rar
|
70
|
+
- deployers/ejb3.deployer
|
71
|
+
- deployers/ejb3-deployers-jboss-beans.xml
|
72
|
+
- deployers/jboss-ejb3-endpoint-deployer.jar
|
73
|
+
- deployers/jboss-ejb3-metrics-deployer.jar
|
74
|
+
|
75
|
+
ejb2:
|
76
|
+
- deploy/ejb2-container-jboss-beans.xml
|
77
|
+
- deploy/ejb2-timer-service.xml
|
78
|
+
- deployers/ejb-deployer-jboss-beans.xml
|
79
|
+
|
80
|
+
jmx_invoker:
|
81
|
+
- jmx-invoker-service.xml
|
82
|
+
|
83
|
+
ha_http_invoker:
|
84
|
+
- deploy/httpha-invoker.sar
|
85
|
+
|
86
|
+
legacy_invoker:
|
87
|
+
- deploy/legacy-invokers-service.xml
|
88
|
+
|
89
|
+
transaction:
|
90
|
+
- deploy/transaction-jboss-beans.xml
|
91
|
+
- deploy/transaction-service.xml
|
92
|
+
|
93
|
+
remoting:
|
94
|
+
- deploy/remoting-jboss-beans.xml
|
95
|
+
|
96
|
+
properties:
|
97
|
+
- deploy/properties-service.xml
|
98
|
+
|
99
|
+
database:
|
100
|
+
- deploy/hsqldb-ds.xml
|
101
|
+
- deploy/jboss-local-jdbc.rar
|
102
|
+
- deploy/jboss-xa-jdbc.jar
|
103
|
+
- deploy/sqlexception-service.xml
|
104
|
+
|
105
|
+
jsr88:
|
106
|
+
- deploy/jsr88-service.xml
|
107
|
+
|
108
|
+
xnio:
|
109
|
+
- deploy/xnio-provider.jar
|
110
|
+
- deployers/xnio.deployer
|
data/lib/rboss/jboss_path.rb
CHANGED
@@ -42,6 +42,7 @@ module JBoss
|
|
42
42
|
@profile_name = params[:profile].to_s
|
43
43
|
@type = params[:type]
|
44
44
|
@version = params[:version]
|
45
|
+
@logger = params[:logger]
|
45
46
|
end
|
46
47
|
|
47
48
|
def to_s
|
@@ -62,7 +63,9 @@ module JBoss
|
|
62
63
|
|
63
64
|
# Encrypts the given password using the SecureIdentityLoginModule
|
64
65
|
def encrypt password
|
65
|
-
|
66
|
+
command = "java -cp #{jboss_logging_lib_path}:#{jbosssx_lib_path} org.jboss.resource.security.SecureIdentityLoginModule #{password}"
|
67
|
+
@logger.debug command if @logger
|
68
|
+
encrypted = `#{command}`
|
66
69
|
encrypted.chomp.split(/:/)[1].strip
|
67
70
|
end
|
68
71
|
|
data/lib/rboss/jboss_profile.rb
CHANGED
@@ -123,7 +123,7 @@ module JBoss
|
|
123
123
|
@logger = @opts[:logger]
|
124
124
|
unless @logger
|
125
125
|
@logger = Logger::new STDOUT
|
126
|
-
@logger.level = opts[:log_level]
|
126
|
+
@logger.level = opts[:log_level] || Logger::INFO
|
127
127
|
formatter = Logger::Formatter.new
|
128
128
|
|
129
129
|
def formatter.call(severity, time, program_name, message)
|
@@ -137,7 +137,8 @@ module JBoss
|
|
137
137
|
@jboss = JBoss::Path::new @jboss_home,
|
138
138
|
:profile => @profile,
|
139
139
|
:type => @opts[:type],
|
140
|
-
:version => @opts[:version]
|
140
|
+
:version => @opts[:version],
|
141
|
+
:logger => @logger
|
141
142
|
initialize_components
|
142
143
|
end
|
143
144
|
|
@@ -299,9 +300,9 @@ module JBoss
|
|
299
300
|
:path => "#{@base_dir}/resources/mod_cluster.sar",
|
300
301
|
}
|
301
302
|
|
302
|
-
register :
|
303
|
+
register :jbossweb,
|
303
304
|
|
304
|
-
:type => JBoss::
|
305
|
+
:type => JBoss::JBossWeb,
|
305
306
|
:priority => @@setup
|
306
307
|
|
307
308
|
register :run_conf,
|
@@ -324,6 +325,11 @@ module JBoss
|
|
324
325
|
:type => JBoss::Slimming,
|
325
326
|
:priority => @@post_setup
|
326
327
|
|
328
|
+
register :restore,
|
329
|
+
|
330
|
+
:type => JBoss::Restore,
|
331
|
+
:priority => @@post_setup + 5
|
332
|
+
|
327
333
|
register :init_script,
|
328
334
|
|
329
335
|
:type => JBoss::ServiceScript,
|
@@ -20,6 +20,8 @@
|
|
20
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
21
|
# THE SOFTWARE.
|
22
22
|
|
23
|
+
require 'logger'
|
24
|
+
|
23
25
|
module JBoss
|
24
26
|
module Twiddle
|
25
27
|
class Invoker
|
@@ -47,6 +49,19 @@ module JBoss
|
|
47
49
|
@password = params[:password]
|
48
50
|
|
49
51
|
@command = "#{@jboss_home}/bin/twiddle.sh -s #{@server} -u '#{@user}' -p '#{@password}'"
|
52
|
+
|
53
|
+
@logger = params[:logger]
|
54
|
+
unless @logger
|
55
|
+
@logger = Logger::new STDOUT
|
56
|
+
@logger.level = params[:log_level] || Logger::INFO
|
57
|
+
formatter = Logger::Formatter.new
|
58
|
+
|
59
|
+
def formatter.call(severity, time, program_name, message)
|
60
|
+
"#{severity} : #{message}\n"
|
61
|
+
end
|
62
|
+
|
63
|
+
@logger.formatter = formatter
|
64
|
+
end
|
50
65
|
end
|
51
66
|
|
52
67
|
def home
|
@@ -58,7 +73,9 @@ module JBoss
|
|
58
73
|
end
|
59
74
|
|
60
75
|
def execute command, *arguments
|
61
|
-
|
76
|
+
exec = shell command, arguments
|
77
|
+
@logger.debug exec
|
78
|
+
result = `#{exec}`.chomp
|
62
79
|
return nil if result["ERROR [Twiddle] Command failure"]
|
63
80
|
result
|
64
81
|
end
|
data/lib/rboss/version.rb
CHANGED
@@ -0,0 +1,101 @@
|
|
1
|
+
# The MIT License
|
2
|
+
#
|
3
|
+
# Copyright (c) 2011 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
|
data/test/mbean_test.rb
CHANGED
@@ -27,9 +27,11 @@ class MBeanTest < Test::Unit::TestCase
|
|
27
27
|
|
28
28
|
def twiddle
|
29
29
|
twiddle = Object.new
|
30
|
-
|
30
|
+
|
31
|
+
def twiddle.execute command, *args
|
31
32
|
"#{command} #{args.join " "}".strip
|
32
33
|
end
|
34
|
+
|
33
35
|
twiddle
|
34
36
|
end
|
35
37
|
|
@@ -46,8 +48,8 @@ class MBeanTest < Test::Unit::TestCase
|
|
46
48
|
|
47
49
|
def test_invoke
|
48
50
|
mbean = JBoss::MBean::new :pattern => 'jboss.system:type=Server', :twiddle => twiddle
|
49
|
-
assert_equal "invoke jboss.system:type=Server shutdown", mbean.shutdown
|
50
|
-
assert_equal "invoke jboss.system:type=Server traceInstructions true", mbean.traceInstructions
|
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)
|
51
53
|
end
|
52
54
|
|
53
55
|
end
|
data/test/test_helper.rb
CHANGED
@@ -34,10 +34,9 @@ module TestHelper
|
|
34
34
|
|
35
35
|
def all
|
36
36
|
@all ||= {
|
37
|
-
:org => [5.1
|
38
|
-
:eap => [5.
|
39
|
-
:soa_p => 5
|
40
|
-
:epp => 5.1
|
37
|
+
:org => [5.1],
|
38
|
+
:eap => [5.1],
|
39
|
+
:soa_p => 5
|
41
40
|
}
|
42
41
|
@all
|
43
42
|
end
|
@@ -93,9 +92,14 @@ module TestHelper
|
|
93
92
|
:profile => :rboss,
|
94
93
|
:logger => @logger
|
95
94
|
@jboss = @jboss_profile.jboss
|
96
|
-
blocks[:configure]
|
97
|
-
|
98
|
-
|
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
|
99
103
|
end
|
100
104
|
|
101
105
|
def create_file_processor
|
data/test/test_suite.rb
CHANGED
@@ -24,12 +24,13 @@ require 'test/unit'
|
|
24
24
|
require 'test/unit/testsuite'
|
25
25
|
require_relative 'deploy_folder_test'
|
26
26
|
require_relative 'datasource_test'
|
27
|
+
require_relative 'jbossweb_test'
|
27
28
|
require_relative 'mbean_test'
|
28
29
|
|
29
30
|
class TestSuite < Test::Unit::TestSuite
|
30
31
|
|
31
32
|
def initialize
|
32
|
-
self << DeployFolderTest << DatasourceTest << MBeanTest
|
33
|
+
self << DeployFolderTest << DatasourceTest << JBossWebTest << MBeanTest
|
33
34
|
end
|
34
35
|
|
35
36
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rboss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.3.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ataxexe
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-09-
|
13
|
+
date: 2011-09-29 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: |-
|
@@ -45,10 +45,12 @@ files:
|
|
45
45
|
- lib/rboss/components/org/jmx.rb
|
46
46
|
- lib/rboss/components/profile_folder.rb
|
47
47
|
- lib/rboss/components/resource.rb
|
48
|
+
- lib/rboss/components/restore_slimming.rb
|
48
49
|
- lib/rboss/components/run_conf.rb
|
49
50
|
- lib/rboss/components/run_conf.yaml
|
50
51
|
- lib/rboss/components/service_script.rb
|
51
52
|
- lib/rboss/components/slimming.rb
|
53
|
+
- lib/rboss/components/slimming.yaml
|
52
54
|
- lib/rboss/components/soa-p/hypersonic_replacer.rb
|
53
55
|
- lib/rboss/components/soa-p/jmx.rb
|
54
56
|
- lib/rboss/components/xadatasource.rb
|
@@ -69,6 +71,7 @@ files:
|
|
69
71
|
- rboss.gemspec
|
70
72
|
- test/datasource_test.rb
|
71
73
|
- test/deploy_folder_test.rb
|
74
|
+
- test/jbossweb_test.rb
|
72
75
|
- test/mbean_test.rb
|
73
76
|
- test/test_helper.rb
|
74
77
|
- test/test_suite.rb
|
@@ -102,6 +105,7 @@ summary: A Ruby way to do a JBoss work!
|
|
102
105
|
test_files:
|
103
106
|
- test/datasource_test.rb
|
104
107
|
- test/deploy_folder_test.rb
|
108
|
+
- test/jbossweb_test.rb
|
105
109
|
- test/mbean_test.rb
|
106
110
|
- test/test_helper.rb
|
107
111
|
- test/test_suite.rb
|