QCMetaServer.rb:112: [BUG] Segmentation faultruby 1.8.6 (2008-08-11) [i386-mswin32]This application has requested the Runtime to terminate it in an unusual way.Please contact the application’s support team for more information.
QCMetaServer.rb:112: [BUG] Segmentation fault ruby 1.8.6 (2008-08-11) [i386-mswin32] This application has requested the Runtime to terminate it in an unusual way. Please contact the application’s support team for more information.
p "Global initializion."
$qc = WIN32OLE.new("TDApiOle80.TDConnection")
p "Loaded COM => TDApiOle80.TDConnection"
$qc.InitConnectionEx("http://10.2.226.12/qcbin/");
p "QC connection init."
$qc.ConnectProjectEx('ALISOFT_CRM','ALISOFT_CRM2006','cuizheng','');
p "QC project connection init."
require 'sinatra/base'
require 'coderay'
class QCMeta < Sinatra::Base
get '/' do
h = {}
h[rojectName] = $qc.ProjectName
h[:ServerURL] = $qc.ServerURL
h[:ServerTime] = $qc.ServerTime
h[rojectProperties] = $qc.ProjectProperties
h[:ServerName] = $qc.ServerName
h.to_xml
end
get '/ole' do
h = {
"TDApiOle80.TDConnection<functional>" => $qc.ole_func_methods.map{|f|f.to_s},
"TDApiOle80.TDConnection<property(get)>" => $qc.ole_get_methods.map{|f|f.to_s},
"TDApiOle80.TDConnection<property(set)>" => $qc.ole_put_methods.map{|f|f.to_s}
}.to_json
params[:color].downcase == "true" ? CodeRay.scan(h,:json).div(:line_number => :tables) : h
end
get '/projects' do
{rojectsList => $qc.ProjectsList}.to_xml
end
=begin
<C#>
int intSub = 286;
SubjectNode nodSub = objTree.get_NodeById(intSub) as SubjectNode;
TestFactory objTF = nodSub.TestFactory as TestFactory;
lstList = objTF.NewList("");
foreach (Test objTest in lstList)
{
MessageBox.Show((string)objTest.Name);
}
=end
#~ tm = $qc.TreeManager
#~ nod = tm.get_NodeById(id)
#~ nod.TestFactory.NewList("").each do |test|
#~ pp test.Status
#~ end
=begin
<VB>
Dim BugFactory, BugList
Set BugFactory = QCConnection.BugFactory
Set BugList = BugFactory.NewList("") 'Get a list of all the defects.
=end
get "/bugs" do
bf = $qc.BugFactory
bflist = bf.NewList("")
max = params[:max] || 100
i = 0
h = {}
bflist.each do |bug|
h[bug.ID] = {
:Status => bug.Status,
:AssignedTo => bug.AssignedTo,
etectedBy => bug.DetectedBy,
riority => bug.Priority,
:Summary => bug.Summary
}
i >= max ? break : i+=1
end
{:BUGS => h,:COUNT => bflist.Count}.to_xml
end
def self.run!(options={},&trap_handler)
set options
handler = detect_rack_handler
handler_name = handler.name.gsub(/.*::/, '')
puts "== Sinatra/#{Sinatra::VERSION} has taken the stage " +
"on #{port} for #{environment} with backup from #{handler_name}" unless handler_name =~/cgi/i
handler.run self, :Host => host, ort => port do |server|
trap(:INT) do
trap_handler.call
## Use thins' hard #stop! if available, otherwise just #stop
server.respond_to?(:stop!) ? server.stop! : server.stop
puts "\n== Sinatra has ended his set (crowd applauds)" unless handler_name =~/cgi/i
end
set :running, true
end
rescue Errno::EADDRINUSE => e
puts "== Someone is already performing on port #{port}!"
end
end
QCMeta.run!(:host=>'0.0.0.0', :port => 4567){
begin
$qc.DisconnectProject
p "QCMeta disconnected to QC."
$qc.ReleaseConnection
p "QCMeta released to QC."
p "QCMeta will shutdown."
rescue => e
p "QCMeta disconnect and release faile."
p "But server still going to shutdown."
p e.to
end
}