torquespec 0.4.8 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,8 +53,10 @@ require 'torquespec/daemon'
53
53
  module TorqueSpec
54
54
  module ObjectExtensions
55
55
  def remote_describe(*args, &example_group_block)
56
- group = describe(*args, &example_group_block)
57
- TorqueSpec.remote? ? group : group.extend( TorqueSpec::Daemon::Client )
56
+ unless TorqueSpec.domain_mode
57
+ group = describe(*args, &example_group_block)
58
+ TorqueSpec.remote? ? group : group.extend( TorqueSpec::Daemon::Client )
59
+ end
58
60
  end
59
61
  end
60
62
  end
@@ -19,28 +19,23 @@ module TorqueSpec
19
19
  # ignorable
20
20
  end
21
21
 
22
+ def deployed?(path)
23
+ response = JSON.parse(api(:operation => "read-children-names", "child-type" => "deployment"))
24
+ response['result'].include? addressify(path)
25
+ end
26
+
22
27
  def _deploy(path)
23
- once = true
24
- begin
25
- api( :operation => "add",
26
- :address => [ "deployment", addressify(path) ],
27
- :content => [ { :url=>urlify(path)} ] )
28
- rescue Exception
29
- _undeploy(path)
30
- if once
31
- once = false
32
- retry
33
- else
34
- raise
35
- end
36
- end
28
+ _undeploy(path) if deployed?(path)
29
+ api( :operation => "add",
30
+ :address => [{ :deployment => addressify(path) }],
31
+ :content => [{ :url => urlify(path) }] )
37
32
  api( :operation => "deploy",
38
- :address => [ "deployment", addressify(path) ] )
33
+ :address => [{ :deployment => addressify(path) }] )
39
34
  end
40
35
 
41
36
  def _undeploy(path)
42
37
  api( :operation => "remove",
43
- :address => [ "deployment", addressify(path) ] )
38
+ :address => [{ "deployment" => addressify(path) }] )
44
39
  end
45
40
 
46
41
  def ready?
@@ -66,4 +61,52 @@ module TorqueSpec
66
61
  File.basename(path)
67
62
  end
68
63
  end
64
+
65
+ module Domain
66
+
67
+ def host_controller
68
+ JSON.parse(api(:operation => "read-children-resources", "child-type" => "host"))['result'].first
69
+ end
70
+
71
+ def server_group
72
+ @server_group ||= JSON.parse(api(:operation => "read-children-names", "child-type" => "server-group"))['result'].first
73
+ end
74
+
75
+ def start_command
76
+ "#{TorqueSpec.java_home}/bin/java -D\"[Process Controller]\" #{TorqueSpec.jvm_args} -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.domain.default.config=domain.xml -Djboss.host.default.config=host.xml -Dorg.jboss.boot.log.file=#{TorqueSpec.jboss_home}/domain/log/process-controller.log -Dlogging.configuration=file:#{TorqueSpec.jboss_home}/domain/configuration/logging.properties -jar #{TorqueSpec.jboss_home}/jboss-modules.jar -mp #{TorqueSpec.jboss_home}/modules org.jboss.as.process-controller -jboss-home #{TorqueSpec.jboss_home} -jvm #{TorqueSpec.java_home}/bin/java -mp #{TorqueSpec.jboss_home}/modules -- -Dorg.jboss.boot.log.file=#{TorqueSpec.jboss_home}/domain/log/host-controller.log -Dlogging.configuration=file:#{TorqueSpec.jboss_home}/domain/configuration/logging.properties #{TorqueSpec.jvm_args} -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.domain.default.config=domain.xml -Djboss.host.default.config=host.xml -- -default-jvm #{TorqueSpec.java_home}/bin/java"
77
+ end
78
+
79
+ def ready?
80
+ host = host_controller[1]
81
+ host["server-config"] == host["server"]
82
+ rescue
83
+ false
84
+ end
85
+
86
+ def _deploy(path)
87
+ _undeploy(path) if deployed?(path)
88
+ api( :operation => "add",
89
+ :address => [{ :deployment => addressify(path) }],
90
+ :content => [{ :url => urlify(path) }] )
91
+ api( :operation => "add",
92
+ :address => [{"server-group" => server_group}, {:deployment => addressify(path)}],
93
+ :content => [{ :url => urlify(path) }] )
94
+ api( :operation => "deploy",
95
+ :address => [{"server-group" => server_group}, {:deployment => addressify(path)}] )
96
+ end
97
+
98
+ def _undeploy(path)
99
+ api( :operation => "remove",
100
+ :address => [{"server-group" => server_group}, {:deployment => addressify(path)}] )
101
+ api( :operation => "remove",
102
+ :address => [{"deployment" => addressify(path)}] )
103
+ end
104
+
105
+ def shutdown
106
+ api( :operation => "shutdown", :address => [ "host", host_controller[0] ] )
107
+ rescue EOFError
108
+ # ignorable
109
+ end
110
+
111
+ end
69
112
  end
@@ -7,6 +7,7 @@ module TorqueSpec
7
7
 
8
8
  def initialize
9
9
  self.extend( TorqueSpec.as7? ? AS7 : AS6 )
10
+ self.extend( Domain ) if TorqueSpec.domain_mode
10
11
  end
11
12
 
12
13
  def start(opts={})
@@ -1,4 +1,5 @@
1
1
  require 'torquespec/deployment_descriptor'
2
+ require 'java'
2
3
 
3
4
  module TorqueSpec
4
5
 
@@ -19,7 +20,7 @@ module TorqueSpec
19
20
  end
20
21
 
21
22
  class << self
22
- attr_accessor :knob_root, :jboss_home, :jvm_args, :max_heap, :lazy, :drb_port, :spec_dir
23
+ attr_accessor :knob_root, :jboss_home, :jvm_args, :max_heap, :lazy, :drb_port, :spec_dir, :domain_mode
23
24
  def configure
24
25
  yield self
25
26
  end
@@ -33,7 +34,6 @@ module TorqueSpec
33
34
  @jboss_home ||= ENV['JBOSS_HOME'] || jboss_home_from_server_gem
34
35
  end
35
36
  def jruby_home
36
- require 'java'
37
37
  File.expand_path(java.lang.System.getProperty('jruby.home'))
38
38
  end
39
39
  def java_home
@@ -91,6 +91,7 @@ end
91
91
  TorqueSpec.configure do |config|
92
92
  config.drb_port = 7772
93
93
  config.knob_root = ".torquespec"
94
+ config.domain_mode = %w(yes true 1).include?(java.lang.System.getProperty('domain.mode') || ENV['DOMAIN_MODE'])
94
95
  config.jvm_args = "-Xms64m -Xmx1024m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSClassUnloadingEnabled -Djruby.home=#{config.jruby_home}"
95
96
  end
96
97
 
@@ -1,3 +1,3 @@
1
1
  module TorqueSpec
2
- VERSION = "0.4.8"
2
+ VERSION = "0.4.9"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torquespec
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 8
10
- version: 0.4.8
9
+ - 9
10
+ version: 0.4.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jim Crossley
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-01-25 00:00:00 -05:00
19
+ date: 2012-04-18 00:00:00 -04:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency