Module: Tlb
Defined Under Namespace
Modules: Balancer, RSpec, RunData, TestUnit, Util
Classes: BalancerProcess, ForkBalancerProcess, JavaBalancerProcess
Constant Summary
collapse
- TLB_OUT_FILE =
'TLB_OUT_FILE'
- TLB_ERR_FILE =
'TLB_ERR_FILE'
- TLB_APP =
'TLB_APP'
Class Method Summary
collapse
Class Method Details
.balance_and_order(file_set) ⇒ Object
77
78
79
80
|
# File 'lib/tlb.rb', line 77
def self.balance_and_order file_set
ensure_server_running
Balancer.send(Balancer::BALANCE_PATH, file_set.join("\n")).split("\n")
end
|
.balancer_process_type ⇒ Object
.can_fork? ⇒ Boolean
116
117
118
|
# File 'lib/tlb.rb', line 116
def self.can_fork?
RUBY_PLATFORM != 'java'
end
|
.ensure_server_running ⇒ Object
96
97
98
|
# File 'lib/tlb.rb', line 96
def self.ensure_server_running
server_running? || fail_as_balancer_is_not_running
end
|
.fail_as_balancer_is_not_running ⇒ Object
92
93
94
|
# File 'lib/tlb.rb', line 92
def self.fail_as_balancer_is_not_running
raise "Balancer server must be started before tests are run."
end
|
.relative_file_path(file_name) ⇒ Object
68
69
70
71
|
# File 'lib/tlb.rb', line 68
def self.relative_file_path file_name
abs_file_name = File.expand_path(file_name)
rel_file_name = abs_file_name.sub(/^#{Dir.pwd}/, '.')
end
|
.relative_file_paths(file_names) ⇒ Object
73
74
75
|
# File 'lib/tlb.rb', line 73
def self.relative_file_paths file_names
file_names.map { |file_name| relative_file_path(file_name) }
end
|
.root_dir ⇒ Object
104
105
106
|
# File 'lib/tlb.rb', line 104
def self.root_dir
File.expand_path(File.join(File.dirname(__FILE__), ".."))
end
|
.server_command ⇒ Object
112
113
114
|
# File 'lib/tlb.rb', line 112
def self.server_command
"java -jar #{tlb_jar}"
end
|
.server_running? ⇒ Boolean
100
101
102
|
# File 'lib/tlb.rb', line 100
def self.server_running?
Balancer.running?
end
|
.start_server ⇒ Object
228
229
230
231
232
233
|
# File 'lib/tlb.rb', line 228
def self.start_server
ENV[TLB_APP] = 'tlb.balancer.BalancerInitializer'
bal_klass = balancer_process_type
@balancer_process = bal_klass.new(server_command)
Balancer.wait_for_start
end
|
.stop_server ⇒ Object
235
236
237
|
# File 'lib/tlb.rb', line 235
def self.stop_server
@balancer_process.die
end
|
.suite_result(suite_name, result) ⇒ Object
.suite_time(suite_name, mills) ⇒ Object
.tlb_jar ⇒ Object
108
109
110
|
# File 'lib/tlb.rb', line 108
def self.tlb_jar
File.expand_path(Dir.glob(File.join(root_dir, "tlb-alien*")).first)
end
|