rboss 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/.gitignore +9 -0
  2. data/Gemfile +4 -0
  3. data/Rakefile +1 -0
  4. data/bin/jboss-profile +90 -0
  5. data/bin/twiddle +230 -0
  6. data/examples/jboss_profile/jbb_profile_1.yaml +32 -0
  7. data/examples/jboss_profile/jbb_profile_2.yaml +32 -0
  8. data/examples/jboss_profile/jboss_profile.yaml +7 -0
  9. data/examples/monitor/simple_monitor.rb +61 -0
  10. data/lib/rboss.rb +25 -0
  11. data/lib/rboss/component_processor.rb +177 -0
  12. data/lib/rboss/components/component.rb +52 -0
  13. data/lib/rboss/components/datasource.rb +198 -0
  14. data/lib/rboss/components/deploy_folder.rb +104 -0
  15. data/lib/rboss/components/hypersonic_replacer.rb +58 -0
  16. data/lib/rboss/components/jbossweb.rb +117 -0
  17. data/lib/rboss/components/jmx.rb +88 -0
  18. data/lib/rboss/components/mod_cluster.rb +81 -0
  19. data/lib/rboss/components/org/6.0/deploy_folder.rb +33 -0
  20. data/lib/rboss/components/org/jmx.rb +59 -0
  21. data/lib/rboss/components/profile_folder.rb +44 -0
  22. data/lib/rboss/components/resource.rb +53 -0
  23. data/lib/rboss/components/run_conf.rb +90 -0
  24. data/lib/rboss/components/run_conf.yaml +22 -0
  25. data/lib/rboss/components/service_script.rb +55 -0
  26. data/lib/rboss/components/slimming.rb +124 -0
  27. data/lib/rboss/components/soa-p/hypersonic_replacer.rb +79 -0
  28. data/lib/rboss/components/soa-p/jmx.rb +47 -0
  29. data/lib/rboss/components/xadatasource.rb +67 -0
  30. data/lib/rboss/file_processor.rb +107 -0
  31. data/lib/rboss/jboss_path.rb +53 -0
  32. data/lib/rboss/jboss_profile.rb +344 -0
  33. data/lib/rboss/resources/jboss_init_redhat.sh.erb +140 -0
  34. data/lib/rboss/resources/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml +282 -0
  35. data/lib/rboss/resources/mod_cluster.sar/mod_cluster-1.1.2.Final.jar +0 -0
  36. data/lib/rboss/resources/run.conf.erb +62 -0
  37. data/lib/rboss/twiddle.rb +25 -0
  38. data/lib/rboss/twiddle/base_monitor.rb +57 -0
  39. data/lib/rboss/twiddle/mbean.rb +82 -0
  40. data/lib/rboss/twiddle/monitor.rb +144 -0
  41. data/lib/rboss/twiddle/scanner.rb +92 -0
  42. data/lib/rboss/twiddle/twiddle.rb +71 -0
  43. data/lib/rboss/utils.rb +33 -0
  44. data/lib/rboss/version.rb +25 -0
  45. data/rboss.gemspec +20 -0
  46. data/test/datasource_test.rb +211 -0
  47. data/test/deploy_folder_test.rb +126 -0
  48. data/test/mbean_test.rb +53 -0
  49. data/test/test_helper.rb +124 -0
  50. data/test/test_suite.rb +35 -0
  51. metadata +109 -0
@@ -0,0 +1,124 @@
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 '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, 6.0],
38
+ :eap => [5.0, 5.1],
39
+ :soa_p => 5,
40
+ :epp => 5.1
41
+ }
42
+ @all
43
+ end
44
+
45
+ def jboss_dir
46
+ ENV["JBOSS_DIR"] or File.expand_path "~/jboss"
47
+ end
48
+
49
+ def for_test_with type, version = nil, &block
50
+ @test_blocks ||= {}
51
+ if type == :all
52
+ all.each do |key, value|
53
+ set_block key, value, :configure, block
54
+ end
55
+ else
56
+ set_block type, version, :configure, block
57
+ end
58
+ end
59
+
60
+ def for_assertions_with type, version = nil, &block
61
+ @assertion_blocks ||= {}
62
+ if type == :all
63
+ all.each do |key, value|
64
+ set_block key, value, :assertion, block
65
+ end
66
+ else
67
+ set_block type, version, :assertion, block
68
+ end
69
+ end
70
+
71
+ def do_test
72
+ @test_blocks.each do |type, versions|
73
+ versions.each do |version, blocks|
74
+ do_test_with type, version, blocks
75
+ end
76
+ end
77
+ end
78
+
79
+ def do_test_with type, version, blocks
80
+ map = {
81
+ :eap => "#{jboss_dir}/eap/jboss-eap-#{version}/jboss-as",
82
+ :epp => "#{jboss_dir}/epp/jboss-epp-#{version}/jboss-as",
83
+ :soa_p => "#{jboss_dir}/soa-p/jboss-soa-p-#{version}/jboss-as",
84
+ :org => "#{jboss_dir}/org/jboss-#{version}"
85
+ }
86
+ return unless File.exist? map[type]
87
+ @logger = Logger::new STDOUT
88
+ @logger.level = Logger::WARN
89
+ @jboss_profile = Profile::new :jboss_home => map[type],
90
+ :type => type,
91
+ :version => version,
92
+ :base_profile => :all,
93
+ :profile => :rboss,
94
+ :logger => @logger
95
+ @jboss = @jboss_profile.jboss
96
+ blocks[:configure].call @jboss_profile
97
+ @jboss_profile.create
98
+ blocks[:assertion].call @jboss
99
+ end
100
+
101
+ def create_file_processor
102
+ FileProcessor::new :logger => @logger, :var => @jboss
103
+ end
104
+
105
+ private
106
+
107
+ def set_block(type, version, key, block)
108
+ @test_blocks[type] ||= {}
109
+ if version.kind_of? Array
110
+ version.each do |v|
111
+ @test_blocks[type][v] ||= {}
112
+ @test_blocks[type][v][key] = block
113
+ end
114
+ else
115
+ @test_blocks[type][version] ||= {}
116
+ @test_blocks[type][version][key] = block
117
+ end
118
+ end
119
+
120
+ end
121
+
122
+ class Test::Unit::TestCase
123
+ include TestHelper
124
+ end
@@ -0,0 +1,35 @@
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 'test/unit'
24
+ require 'test/unit/testsuite'
25
+ require_relative 'deploy_folder_test'
26
+ require_relative 'datasource_test'
27
+ require_relative 'mbean_test'
28
+
29
+ class TestSuite < Test::Unit::TestSuite
30
+
31
+ def initialize
32
+ self << DeployFolderTest << DatasourceTest << MBeanTest
33
+ end
34
+
35
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rboss
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: ruby
7
+ authors:
8
+ - Ataxexe
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-08-11 00:00:00 Z
14
+ dependencies: []
15
+
16
+ description: This gem help you to create a JBoss profile and some other things like building twiddle scripts
17
+ email:
18
+ - ataxexe@gmail.com
19
+ executables:
20
+ - jboss-profile
21
+ - twiddle
22
+ extensions: []
23
+
24
+ extra_rdoc_files: []
25
+
26
+ files:
27
+ - .gitignore
28
+ - Gemfile
29
+ - Rakefile
30
+ - bin/jboss-profile
31
+ - bin/twiddle
32
+ - examples/jboss_profile/jbb_profile_1.yaml
33
+ - examples/jboss_profile/jbb_profile_2.yaml
34
+ - examples/jboss_profile/jboss_profile.yaml
35
+ - examples/monitor/simple_monitor.rb
36
+ - lib/rboss.rb
37
+ - lib/rboss/component_processor.rb
38
+ - lib/rboss/components/component.rb
39
+ - lib/rboss/components/datasource.rb
40
+ - lib/rboss/components/deploy_folder.rb
41
+ - lib/rboss/components/hypersonic_replacer.rb
42
+ - lib/rboss/components/jbossweb.rb
43
+ - lib/rboss/components/jmx.rb
44
+ - lib/rboss/components/mod_cluster.rb
45
+ - lib/rboss/components/org/6.0/deploy_folder.rb
46
+ - lib/rboss/components/org/jmx.rb
47
+ - lib/rboss/components/profile_folder.rb
48
+ - lib/rboss/components/resource.rb
49
+ - lib/rboss/components/run_conf.rb
50
+ - lib/rboss/components/run_conf.yaml
51
+ - lib/rboss/components/service_script.rb
52
+ - lib/rboss/components/slimming.rb
53
+ - lib/rboss/components/soa-p/hypersonic_replacer.rb
54
+ - lib/rboss/components/soa-p/jmx.rb
55
+ - lib/rboss/components/xadatasource.rb
56
+ - lib/rboss/file_processor.rb
57
+ - lib/rboss/jboss_path.rb
58
+ - lib/rboss/jboss_profile.rb
59
+ - lib/rboss/resources/jboss_init_redhat.sh.erb
60
+ - lib/rboss/resources/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml
61
+ - lib/rboss/resources/mod_cluster.sar/mod_cluster-1.1.2.Final.jar
62
+ - lib/rboss/resources/run.conf.erb
63
+ - lib/rboss/twiddle.rb
64
+ - lib/rboss/twiddle/base_monitor.rb
65
+ - lib/rboss/twiddle/mbean.rb
66
+ - lib/rboss/twiddle/monitor.rb
67
+ - lib/rboss/twiddle/scanner.rb
68
+ - lib/rboss/twiddle/twiddle.rb
69
+ - lib/rboss/utils.rb
70
+ - lib/rboss/version.rb
71
+ - rboss.gemspec
72
+ - test/datasource_test.rb
73
+ - test/deploy_folder_test.rb
74
+ - test/mbean_test.rb
75
+ - test/test_helper.rb
76
+ - test/test_suite.rb
77
+ homepage: ""
78
+ licenses: []
79
+
80
+ post_install_message:
81
+ rdoc_options: []
82
+
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: "0"
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: "0"
97
+ requirements: []
98
+
99
+ rubyforge_project: rboss
100
+ rubygems_version: 1.8.6
101
+ signing_key:
102
+ specification_version: 3
103
+ summary: A Ruby way to do a JBoss work!
104
+ test_files:
105
+ - test/datasource_test.rb
106
+ - test/deploy_folder_test.rb
107
+ - test/mbean_test.rb
108
+ - test/test_helper.rb
109
+ - test/test_suite.rb