Merge branch 'develop' of https://github.com/vivo-project/VIVO into develop
This commit is contained in:
commit
2d0389e9e9
26 changed files with 499 additions and 70 deletions
64
utilities/ISF-transition/obsoleteUris/directory_walker.rb
Normal file
64
utilities/ISF-transition/obsoleteUris/directory_walker.rb
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
require 'find'
|
||||||
|
|
||||||
|
class DirectoryWalker
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
private
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def start_walking()
|
||||||
|
Find.find(@directory_root) do |path|
|
||||||
|
if FileTest.directory?(path)
|
||||||
|
if File.basename(path).start_with?(".")
|
||||||
|
Find.prune # Don't look any further into this directory.
|
||||||
|
else
|
||||||
|
next
|
||||||
|
end
|
||||||
|
elsif @known_exceptions.skip?(path)
|
||||||
|
Find.prune
|
||||||
|
else
|
||||||
|
scan_file(path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def scan_file(path)
|
||||||
|
@report.register_file(path)
|
||||||
|
lines = File.readlines(path)
|
||||||
|
lines.each_index do |index|
|
||||||
|
line_number = index + 1
|
||||||
|
line = lines[index].strip
|
||||||
|
scan_line(path, line_number, line) unless @known_exceptions.skip?(path, line_number)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def scan_line(path, line_number, line)
|
||||||
|
@obsolete_uris.uris.each do |uri|
|
||||||
|
next if @known_exceptions.skip?(path, line_number, uri)
|
||||||
|
@report.add_event(Event.new(path, line_number, line, uri)) if line =~ Regexp.new(Regexp.quote(uri))
|
||||||
|
end
|
||||||
|
if @complete
|
||||||
|
@obsolete_uris.localnames.each do |localname|
|
||||||
|
term = ":#{localname}"
|
||||||
|
next if @known_exceptions.skip?(path, line_number, term)
|
||||||
|
@report.add_event(Event.new(path, line_number, line, term)) if line =~ Regexp.new(Regexp.quote(term))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
public
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def initialize(directory_root, obsolete_uris, known_exceptions, report, complete)
|
||||||
|
@directory_root = File.expand_path(directory_root)
|
||||||
|
@obsolete_uris = obsolete_uris
|
||||||
|
@known_exceptions = known_exceptions
|
||||||
|
@report = report
|
||||||
|
@complete = complete
|
||||||
|
end
|
||||||
|
|
||||||
|
def walk()
|
||||||
|
start_walking()
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
21
utilities/ISF-transition/obsoleteUris/event.rb
Normal file
21
utilities/ISF-transition/obsoleteUris/event.rb
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
class Event
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
private
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
public
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def initialize(path, line_number, line, string)
|
||||||
|
@path = path
|
||||||
|
@line_number = line_number
|
||||||
|
@line = line
|
||||||
|
@string = string
|
||||||
|
@is_localname = string[0] == ?:
|
||||||
|
end
|
||||||
|
|
||||||
|
def to_s()
|
||||||
|
"#{@path} \n #{@line_number} #{@line} \n #{@string} #{@is_localname ? "Localname" : "URI"}"
|
||||||
|
end
|
||||||
|
end
|
77
utilities/ISF-transition/obsoleteUris/known_exceptions.rb
Normal file
77
utilities/ISF-transition/obsoleteUris/known_exceptions.rb
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
class KnownExceptionsError < StandardError; end
|
||||||
|
|
||||||
|
class ExtensionSkipper
|
||||||
|
def initialize(extension)
|
||||||
|
@extension = extension
|
||||||
|
end
|
||||||
|
|
||||||
|
def skip?(path, line, uri)
|
||||||
|
return File.extname(path) == @extension
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class PathSkipper
|
||||||
|
def initialize(root_path, relative_path)
|
||||||
|
@root_path = root_path
|
||||||
|
@absolute_path = File.expand_path(relative_path, @root_path)
|
||||||
|
end
|
||||||
|
|
||||||
|
def skip?(path, line, uri)
|
||||||
|
return @absolute_path == File.expand_path(path, @root_path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class LineSkipper
|
||||||
|
def initialize(root_path, relative_path, line_number)
|
||||||
|
@inner = PathSkipper.new(root_path, relative_path)
|
||||||
|
@line_number = line_number
|
||||||
|
end
|
||||||
|
|
||||||
|
def skip?(path, line, uri)
|
||||||
|
return @inner.skip?(path, line, uri) && line == @line_number
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class KnownExceptions
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
private
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def parse_file(file)
|
||||||
|
skippers = []
|
||||||
|
File.readlines(file).each do |line|
|
||||||
|
# ignore blank lines, and lines starting with '#' or '!'.
|
||||||
|
line.strip!
|
||||||
|
next if line.length == 0 || line[0..0] == '#' || line[0] == ?!
|
||||||
|
|
||||||
|
if line =~ /^\.[^\/]*$/
|
||||||
|
skippers << ExtensionSkipper.new(line)
|
||||||
|
elsif line =~ /^(\S+)\s*$/
|
||||||
|
skippers << PathSkipper.new(@root_path, $1)
|
||||||
|
elsif line =~ /^(\S+)\s*(\d+)\s*$/
|
||||||
|
skippers << LineSkipper.new(@root_path, $1, $2.to_i)
|
||||||
|
else
|
||||||
|
raise "BOGUS line in known_exceptions file: '#{line}'"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
skippers
|
||||||
|
end
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
public
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def initialize(root_path, file)
|
||||||
|
@root_path = File.expand_path(root_path)
|
||||||
|
@skippers = parse_file(file)
|
||||||
|
end
|
||||||
|
|
||||||
|
def skip?(file, line_number = -1, string = "@!#IMPOSSIBLE#!@")
|
||||||
|
@skippers.each() do |skipper|
|
||||||
|
if skipper.skip?(file, line_number, string)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
120
utilities/ISF-transition/obsoleteUris/obsoleteUriChecker.rb
Normal file
120
utilities/ISF-transition/obsoleteUris/obsoleteUriChecker.rb
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
=begin
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
A utility that scans the code base for the presence of URIs that were made
|
||||||
|
obsolete by the ISF transition.
|
||||||
|
|
||||||
|
Accept a file of obsolete URIs.
|
||||||
|
Blank lines or lines beginning with '#' are comments.
|
||||||
|
Each non-comment line contains an obsolete URI.
|
||||||
|
|
||||||
|
Accept a file of known exceptions.
|
||||||
|
Blank lines or lines beginning with '#' are comments.
|
||||||
|
Each non-comment line is in one of these forms:
|
||||||
|
.xxx - denotes an extension that is exempt from scanning
|
||||||
|
[filepath] - denotes a path, relative to the codebase root, of a
|
||||||
|
file that should not be scanned.
|
||||||
|
[filepath] [line number] - denotes a particular line in a file for
|
||||||
|
which no error should be reported.
|
||||||
|
[filepath] [line number] [uri] - denotes a particular line in a file
|
||||||
|
on which the given uri will not be reported.
|
||||||
|
|
||||||
|
The command line will look like this:
|
||||||
|
ruby obsoleteUriChecker.rb <directory_root> <obsolete_uri_file> <known_exceptions_file> [complete]
|
||||||
|
Where:
|
||||||
|
directory_root - the path to the top if the directory tree we are scanning
|
||||||
|
obsolete_uri_file - the path to the file that lists the obsolete URIs
|
||||||
|
known_exceptions_file - the path to the file that lists the events that we should ignore
|
||||||
|
complete - optional parameter; if present, check for :localname as well as for the full URL.
|
||||||
|
|
||||||
|
E.g.:
|
||||||
|
ruby obsoleteUriChecker.rb ../../.. ../../../productMods/WEB-INF/ontologies/update/diff.tab.txt known_exceptions.txt complete
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
=end
|
||||||
|
|
||||||
|
$: << File.dirname(File.expand_path(__FILE__))
|
||||||
|
require 'known_exceptions'
|
||||||
|
require 'obsolete_uris'
|
||||||
|
require 'report'
|
||||||
|
require 'event'
|
||||||
|
require 'directory_walker'
|
||||||
|
|
||||||
|
class UsageError < StandardError; end
|
||||||
|
|
||||||
|
class ObsoleteUriChecker
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
private
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#
|
||||||
|
# Parse the arguments and complain if they don't make sense.
|
||||||
|
#
|
||||||
|
def parse_arguments(args)
|
||||||
|
raise UsageError, "usage is: obsoleteUriChecker.rb <directory_root> <obsolete_uri_file> <known_exceptions_file> [complete]" unless (3..4).include?(args.length)
|
||||||
|
|
||||||
|
if args[3]
|
||||||
|
raise UsageError, "If provided, the 4th argument must be 'complete'" unless args[3].downcase == 'complete'
|
||||||
|
complete = true
|
||||||
|
else
|
||||||
|
complete = false
|
||||||
|
end
|
||||||
|
|
||||||
|
directory_root = args[0]
|
||||||
|
raise UsageError, "Directory '#{directory_root}' does not exist." unless File.exist?(directory_root)
|
||||||
|
raise UsageError, "Directory '#{directory_root}' is not a directory." unless File.directory?(directory_root)
|
||||||
|
|
||||||
|
obsolete_uri_file = args[1]
|
||||||
|
raise UsageError, "File '#{obsolete_uri_file}' does not exist." unless File.exist?(obsolete_uri_file)
|
||||||
|
obsolete_uris = ObsoleteUris.new(obsolete_uri_file)
|
||||||
|
|
||||||
|
known_exceptions_file = args[2]
|
||||||
|
raise UsageError, "File '#{known_exceptions_file}' does not exist." unless File.exist?(known_exceptions_file)
|
||||||
|
known_exceptions = KnownExceptions.new(directory_root, known_exceptions_file)
|
||||||
|
|
||||||
|
return directory_root, obsolete_uris, known_exceptions, complete
|
||||||
|
end
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
public
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def initialize(args)
|
||||||
|
@report = Report.new(args)
|
||||||
|
@directory_root, @obsolete_uris, @known_exceptions, @complete = parse_arguments(args)
|
||||||
|
rescue UsageError => e
|
||||||
|
puts "\n----------------\nUsage error\n----------------\n\n#{e}\n\n----------------\n\n"
|
||||||
|
exit
|
||||||
|
rescue ObsoleteUrisError => e
|
||||||
|
puts "\n----------------\nObsolete Uris file is invalid\n----------------\n\n#{e}\n\n----------------\n\n"
|
||||||
|
exit
|
||||||
|
rescue KnownExceptionsError => e
|
||||||
|
puts "\n----------------\Known Exceptions file is invalid\n----------------\n\n#{e}\n\n----------------\n\n"
|
||||||
|
exit
|
||||||
|
end
|
||||||
|
|
||||||
|
def scan()
|
||||||
|
walker = DirectoryWalker.new(@directory_root, @obsolete_uris, @known_exceptions, @report, @complete)
|
||||||
|
walker.walk
|
||||||
|
end
|
||||||
|
|
||||||
|
def report()
|
||||||
|
@report.report()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
# Standalone calling.
|
||||||
|
#
|
||||||
|
# Do this if this program was called from the command line. That is, if the command
|
||||||
|
# expands to the path of this file.
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
|
||||||
|
if File.expand_path($0) == File.expand_path(__FILE__)
|
||||||
|
checker = ObsoleteUriChecker.new(ARGV)
|
||||||
|
checker.scan()
|
||||||
|
checker.report()
|
||||||
|
end
|
42
utilities/ISF-transition/obsoleteUris/obsolete_uris.rb
Normal file
42
utilities/ISF-transition/obsoleteUris/obsolete_uris.rb
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
class ObsoleteUrisError < StandardError; end
|
||||||
|
|
||||||
|
class ObsoleteUris
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
private
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def get_localname(uri)
|
||||||
|
delimiter = uri.rindex(/[\/#]/)
|
||||||
|
return uri[delimiter+1..-1] if delimiter
|
||||||
|
raise "BOGUS URI in obsolete_uris file -- no localname: '#{uri}'"
|
||||||
|
end
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
public
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def initialize(file)
|
||||||
|
@uris = []
|
||||||
|
@localnames = []
|
||||||
|
File.read(file).split(/[\r\n]+/).each do |line|
|
||||||
|
# ignore blank lines, and lines starting with '#' or '!'.
|
||||||
|
line.strip!
|
||||||
|
next if line.length == 0 || line[0..0] == '#' || line[0] == ?!
|
||||||
|
|
||||||
|
if line =~ /^(\S+)/
|
||||||
|
@uris << $1
|
||||||
|
@localnames << get_localname($1)
|
||||||
|
else
|
||||||
|
raise "BOGUS line in obsolete_uris file: '#{line}'"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def uris()
|
||||||
|
@uris
|
||||||
|
end
|
||||||
|
|
||||||
|
def localnames()
|
||||||
|
@localnames
|
||||||
|
end
|
||||||
|
end
|
55
utilities/ISF-transition/obsoleteUris/report.rb
Normal file
55
utilities/ISF-transition/obsoleteUris/report.rb
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
class Report
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
private
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def state_arguments()
|
||||||
|
puts
|
||||||
|
puts "-----------------------------------------------------------------"
|
||||||
|
puts " directory to scan = #{@args[0]}"
|
||||||
|
puts " obsolete_uris_file = #{@args[1]}"
|
||||||
|
puts " known exceptions file = #{@args[2]}"
|
||||||
|
puts " complete = #{!@args[3].nil?}"
|
||||||
|
puts "-----------------------------------------------------------------"
|
||||||
|
puts
|
||||||
|
end
|
||||||
|
|
||||||
|
def file_summary()
|
||||||
|
puts " scanned #{@file_count} files"
|
||||||
|
@extensions_count.sort.each do |pair|
|
||||||
|
puts " #{pair[0]} #{pair[1]}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def list_events()
|
||||||
|
@events.each do |event|
|
||||||
|
puts "Event: #{event}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
public
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def initialize(args)
|
||||||
|
@args = args;
|
||||||
|
@file_count = 0
|
||||||
|
@extensions_count = Hash.new(0)
|
||||||
|
@events = []
|
||||||
|
end
|
||||||
|
|
||||||
|
def register_file(path)
|
||||||
|
@file_count += 1
|
||||||
|
@extensions_count[File.extname(path)] += 1
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_event(event)
|
||||||
|
@events << event
|
||||||
|
end
|
||||||
|
|
||||||
|
def report()
|
||||||
|
state_arguments()
|
||||||
|
file_summary()
|
||||||
|
list_events()
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,18 +10,16 @@ directory, for possible inspection later.
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
=end
|
=end
|
||||||
|
|
||||||
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
||||||
require 'date'
|
require 'date'
|
||||||
require "#{File.dirname(__FILE__)}/subscripts/loadParms"
|
|
||||||
|
|
||||||
def figure_time_stamp()
|
def figure_time_stamp()
|
||||||
return DateTime.now.strftime("%Y-%m-%d_%H-%M-%S")
|
return DateTime.now.strftime("%Y-%m-%d_%H-%M-%S")
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir.chdir("/home/jeb228/LoadTesting/versions/#{@version_name}") do |path|
|
@tomcat_logs_dir = version_file('tomcatLogs')
|
||||||
@tomcat_logs_dir = "#{path}/tomcatLogs"
|
if (! File.directory?(@tomcat_logs_dir))
|
||||||
if (! File.directory?(@tomcat_logs_dir))
|
Dir.mkdir(@tomcat_logs_dir)
|
||||||
Dir.mkdir(@tomcat_logs_dir)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir.chdir(@tomcat_logs_dir) do |path|
|
Dir.chdir(@tomcat_logs_dir) do |path|
|
||||||
|
@ -30,6 +28,6 @@ Dir.chdir(@tomcat_logs_dir) do |path|
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir.chdir(@this_logs_dir) do |path|
|
Dir.chdir(@this_logs_dir) do |path|
|
||||||
system('cp ~/LoadTesting/tomcat/logs/* .')
|
system("cp #{@home}/tomcat/logs/* .")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,4 +9,6 @@ Remove any Tomcat logs.
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
=end
|
=end
|
||||||
|
|
||||||
puts system("rm ~/LoadTesting/tomcat/logs/*")
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
||||||
|
|
||||||
|
puts system("rm #{@home}/tomcat/logs/*")
|
||||||
|
|
|
@ -13,12 +13,12 @@ template. Then run the build script.
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
=end
|
=end
|
||||||
|
|
||||||
require "#{File.dirname(__FILE__)}/subscripts/loadParms"
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
||||||
require 'erb'
|
require 'erb'
|
||||||
|
|
||||||
def build_deploy_properties
|
def process_template_file(source, target)
|
||||||
File.open(@deploy_properties_source) do |source_file|
|
File.open(source) do |source_file|
|
||||||
File.open(@deploy_properties_target, 'w') do |target_file|
|
File.open(target, 'w') do |target_file|
|
||||||
raw = source_file.read()
|
raw = source_file.read()
|
||||||
cooked = ERB.new(raw).result
|
cooked = ERB.new(raw).result
|
||||||
target_file.write(cooked)
|
target_file.write(cooked)
|
||||||
|
@ -26,14 +26,18 @@ def build_deploy_properties
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
puts system("rm -r ~/LoadTesting/tomcat/webapps/vivo*")
|
puts system("rm -r #{@home}/tomcat/webapps/vivo*")
|
||||||
puts system("rm -r ~/LoadTesting/tomcat/conf/Catalina/localhost/vivo*")
|
puts system("rm -r #{@home}/tomcat/conf/Catalina/localhost/vivo*")
|
||||||
|
puts system("rm -r #{@home}/tomcat/work/Catalina/localhost/vivo*")
|
||||||
|
|
||||||
@deploy_properties_source = "/home/jeb228/LoadTesting/distros/#{@distro_name}/deploy.properties.template"
|
if (@is_git)
|
||||||
@deploy_properties_target = "/home/jeb228/LoadTesting/distros/#{@distro_name}/vivo/deploy.properties"
|
process_template_file(distro_file("build.properties.template"), distro_file("VIVO/build.properties"))
|
||||||
build_deploy_properties()
|
process_template_file(distro_file("runtime.properties.template"), version_file("data/runtime.properties"))
|
||||||
|
Dir.chdir(distro_file("VIVO")) { |path| system "ant clean deploy" }
|
||||||
Dir.chdir("/home/jeb228/LoadTesting/distros/#{@distro_name}/vivo") do |path|
|
else
|
||||||
system "ant clean deploy"
|
process_template_file(distro_file("deploy.properties.template"), distro_file("vivo/deploy.properties"))
|
||||||
|
Dir.chdir(distro_file("vivo")) { |path| system "ant clean deploy" }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,14 +13,14 @@ the data model.
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
=end
|
=end
|
||||||
|
|
||||||
require "#{File.dirname(__FILE__)}/subscripts/loadParms"
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
||||||
require "#{File.dirname(__FILE__)}/subscripts/upload_file_faker"
|
require "subscripts/upload_file_faker"
|
||||||
|
|
||||||
properties = {}
|
properties = {}
|
||||||
|
|
||||||
properties["uploads_directory"] = "/home/jeb228/LoadTesting/versions/#{@version_name}/data/uploads"
|
properties["uploads_directory"] = version_file('data/uploads')
|
||||||
properties["file_info_file"] = "/home/jeb228/LoadTesting/modelData/#{@site_name}/imageFileInfo.csv"
|
properties["file_info_file"] = "#{@home}/modelData/#{@site_name}/imageFileInfo.csv"
|
||||||
properties["template_file"] = "#{File.dirname(__FILE__)}/subscripts/dummy_image_file.jpg"
|
properties["template_file"] = "#{@home}/scripts/subscripts/dummy_image_file.jpg"
|
||||||
|
|
||||||
if ARGV.length == 1 && ARGV[0] == "doit"
|
if ARGV.length == 1 && ARGV[0] == "doit"
|
||||||
properties["scan_only"] = "false"
|
properties["scan_only"] = "false"
|
||||||
|
|
|
@ -9,4 +9,6 @@ View the VIVO log in Tomcat.
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
=end
|
=end
|
||||||
|
|
||||||
puts system("less ~/LoadTesting/tomcat/logs/vivo.all.log")
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
||||||
|
|
||||||
|
puts system("less #{@home}/tomcat/logs/vivo.all.log")
|
||||||
|
|
|
@ -10,12 +10,12 @@ into an HTML file so we can easily compare them.
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
=end
|
=end
|
||||||
|
|
||||||
require "#{File.dirname(__FILE__)}/subscripts/loadParms"
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
||||||
require "#{File.dirname(__FILE__)}/subscripts/test_result_merger"
|
require 'subscripts/test_result_merger'
|
||||||
|
|
||||||
properties = {}
|
properties = {}
|
||||||
|
|
||||||
source_dir = "/home/jeb228/LoadTesting/testinfo/results/#{@site_name}"
|
source_dir = "#{@home}/testinfo/results/#{@site_name}"
|
||||||
properties["source_directory"] = source_dir
|
properties["source_directory"] = source_dir
|
||||||
properties["target_directory"] = "/var/www/html/loadTesting/"
|
properties["target_directory"] = "/var/www/html/loadTesting/"
|
||||||
properties["site_name"] = "#{@site_name}"
|
properties["site_name"] = "#{@site_name}"
|
||||||
|
@ -38,5 +38,3 @@ trm = TestResultMerger.new(properties)
|
||||||
trm.merge
|
trm.merge
|
||||||
|
|
||||||
puts "TestResultMerger was successful."
|
puts "TestResultMerger was successful."
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,15 +13,15 @@ Use XSL to create an HTML version of the results.
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
=end
|
=end
|
||||||
|
|
||||||
require "#{File.dirname(__FILE__)}/subscripts/loadParms"
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
||||||
|
|
||||||
def locate_files()
|
def locate_files()
|
||||||
test_full_name = "#{@test_name}#{@test_suffix}"
|
test_full_name = "#{@test_name}#{@test_suffix}"
|
||||||
test_source_dir = "/home/jeb228/LoadTesting/testinfo/tests/#{@test_name}"
|
test_source_dir = test_file("tests/#{@test_name}")
|
||||||
@test_jmx_file = "#{test_source_dir}/#{test_full_name}.jmx"
|
@test_jmx_file = "#{test_source_dir}/#{test_full_name}.jmx"
|
||||||
raise "Test file doesn't exist: '#{@test_jmx_file}'." unless File.file?(@test_jmx_file)
|
raise "Test file doesn't exist: '#{@test_jmx_file}'." unless File.file?(@test_jmx_file)
|
||||||
|
|
||||||
result_dir = "/home/jeb228/LoadTesting/testinfo/results/#{@site_name}"
|
result_dir = test_file("results/#{@site_name}")
|
||||||
Dir.mkdir(result_dir) unless File.directory?(result_dir)
|
Dir.mkdir(result_dir) unless File.directory?(result_dir)
|
||||||
|
|
||||||
@test_jtl_file = "#{result_dir}/#{test_full_name}.jtl"
|
@test_jtl_file = "#{result_dir}/#{test_full_name}.jtl"
|
||||||
|
@ -33,7 +33,7 @@ def locate_files()
|
||||||
@test_html_file = "#{result_dir}/#{test_full_name}.html"
|
@test_html_file = "#{result_dir}/#{test_full_name}.html"
|
||||||
File.delete(@test_html_file) if File.file?(@test_html_file)
|
File.delete(@test_html_file) if File.file?(@test_html_file)
|
||||||
|
|
||||||
data_dir = "/home/jeb228/LoadTesting/modelData/#{@site_name}"
|
data_dir = "#{@home}/modelData/#{@site_name}"
|
||||||
@person_uris_file = "#{data_dir}/personUris.csv"
|
@person_uris_file = "#{data_dir}/personUris.csv"
|
||||||
raise "Person URIs file doesn't exist: '#{@person_uris_file}'" unless File.file?(@person_uris_file)
|
raise "Person URIs file doesn't exist: '#{@person_uris_file}'" unless File.file?(@person_uris_file)
|
||||||
@infoResource_uris_file = "#{data_dir}/infoResourceUris.csv"
|
@infoResource_uris_file = "#{data_dir}/infoResourceUris.csv"
|
||||||
|
|
|
@ -12,12 +12,18 @@ Record that selection, along with the desired number of iterations and threads.
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
=end
|
=end
|
||||||
|
|
||||||
@test_parms_file = "#{File.dirname(__FILE__)}/subscripts/_current_test.rb"
|
begin
|
||||||
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
||||||
|
rescue LoadError => e
|
||||||
|
puts e
|
||||||
|
end
|
||||||
|
|
||||||
|
@test_parms_file = "#{@home}/scripts/subscripts/_current_test.rb"
|
||||||
|
|
||||||
# Find out what tests we have available
|
# Find out what tests we have available
|
||||||
def build_test_list()
|
def build_test_list()
|
||||||
@test_names = []
|
@test_names = []
|
||||||
Dir.foreach("/home/jeb228/LoadTesting/testinfo/tests") do |filename|
|
Dir.foreach(test_file('tests')) do |filename|
|
||||||
@test_names.push(filename) unless filename[0,1] == "."
|
@test_names.push(filename) unless filename[0,1] == "."
|
||||||
end
|
end
|
||||||
@test_names.sort!
|
@test_names.sort!
|
||||||
|
|
|
@ -10,12 +10,18 @@ record that choice.
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
=end
|
=end
|
||||||
|
|
||||||
@version_parms_file = "#{File.dirname(__FILE__)}/subscripts/_current_version.rb"
|
begin
|
||||||
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
||||||
|
rescue LoadError => e
|
||||||
|
puts e
|
||||||
|
end
|
||||||
|
|
||||||
|
@version_parms_file = "#{@home}/scripts/subscripts/_current_version.rb"
|
||||||
|
|
||||||
# Find out what versions we have available
|
# Find out what versions we have available
|
||||||
def build_version_list()
|
def build_version_list()
|
||||||
@version_names = []
|
@version_names = []
|
||||||
Dir.foreach("/home/jeb228/LoadTesting/versions") do |filename|
|
Dir.foreach("#{@home}/versions") do |filename|
|
||||||
@version_names.push(filename) unless (filename[0,1] == "_") || (filename[0,1] == ".")
|
@version_names.push(filename) unless (filename[0,1] == "_") || (filename[0,1] == ".")
|
||||||
end
|
end
|
||||||
@version_names.sort!
|
@version_names.sort!
|
||||||
|
|
|
@ -8,5 +8,8 @@ Duh
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
=end
|
=end
|
||||||
puts system("~/LoadTesting/tomcat/bin/startup.sh")
|
|
||||||
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
||||||
|
|
||||||
|
puts system("#{@home}/tomcat/bin/startup.sh")
|
||||||
|
|
||||||
|
|
|
@ -8,13 +8,14 @@ Show the SVN status of the currently-selected distro, both VIVO and Vitro.
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
=end
|
=end
|
||||||
require "#{File.dirname(__FILE__)}/subscripts/loadParms"
|
|
||||||
|
|
||||||
Dir.chdir("/home/jeb228/LoadTesting/distros/#{@distro_name}/vitro") do |path|
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
||||||
system "svn status -u"
|
|
||||||
end
|
if (@is_git)
|
||||||
|
Dir.chdir(distro_file('Vitro')) { |path| system "svn status -u" }
|
||||||
Dir.chdir("/home/jeb228/LoadTesting/distros/#{@distro_name}/vivo") do |path|
|
Dir.chdir(distro_file('VIVO')) { |path| system "svn status -u" }
|
||||||
system "svn status -u"
|
else
|
||||||
|
Dir.chdir(distro_file('vitro')) { |path| system "svn status -u" }
|
||||||
|
Dir.chdir(distro_file('vivo')) { |path| system "svn status -u" }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,5 +9,7 @@ Duh
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
=end
|
=end
|
||||||
|
|
||||||
puts system("~/LoadTesting/tomcat/bin/shutdown.sh")
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
||||||
|
|
||||||
|
puts system("#{@home}/tomcat/bin/shutdown.sh")
|
||||||
|
|
||||||
|
|
|
@ -9,4 +9,6 @@ Start following the tails of all of the logs in Tomcat.
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
=end
|
=end
|
||||||
|
|
||||||
puts system("tail -f ~/LoadTesting/tomcat/logs/*")
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
||||||
|
|
||||||
|
puts system("tail -f #{@home}/tomcat/logs/*")
|
||||||
|
|
|
@ -9,13 +9,12 @@ Use SVN to get the latest revisions to the currently-selected distro.
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
=end
|
=end
|
||||||
|
|
||||||
require "#{File.dirname(__FILE__)}/subscripts/loadParms"
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
||||||
|
|
||||||
Dir.chdir("/home/jeb228/LoadTesting/distros/#{@distro_name}/vitro") do |path|
|
if (@is_git)
|
||||||
system "svn update"
|
Dir.chdir(distro_file('Vitro')) { |path| system "git pull" }
|
||||||
|
Dir.chdir(distro_file('VIVO')) { |path| system "git pull" }
|
||||||
|
else
|
||||||
|
Dir.chdir(distro_file('vitro')) { |path| system "svn update" }
|
||||||
|
Dir.chdir(distro_file('vivo')) { |path| system "svn update" }
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir.chdir("/home/jeb228/LoadTesting/distros/#{@distro_name}/vivo") do |path|
|
|
||||||
system "svn update"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ What is the currently-selected test?
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
=end
|
=end
|
||||||
|
|
||||||
require "#{File.dirname(__FILE__)}/subscripts/loadParms"
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
||||||
|
|
||||||
puts "Current test is #{@test_name}, #{@test_threads} threads, #{@test_iterations} iterations"
|
puts "Current test is #{@test_name}, #{@test_threads} threads, #{@test_iterations} iterations"
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ What is the currently-selected version?
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
=end
|
=end
|
||||||
|
|
||||||
require "#{File.dirname(__FILE__)}/subscripts/loadParms"
|
require File.expand_path('subscripts/common', File.dirname(__FILE__))
|
||||||
|
|
||||||
puts "Current version is #{@version_name}"
|
puts "Current version is #{@version_name}"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
# what is the current test, and how many times will it run?
|
|
||||||
@test_name = 'SimpleTests'
|
|
||||||
@test_threads = '1'
|
|
||||||
@test_iterations = '40'
|
|
|
@ -1,2 +0,0 @@
|
||||||
# what is the current version under test?
|
|
||||||
@version_name = 'cornell1.4'
|
|
33
utilities/LoadTesting/scripts/subscripts/common.rb
Normal file
33
utilities/LoadTesting/scripts/subscripts/common.rb
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#
|
||||||
|
# The path to the LoadTesting directory. Everything is based on this
|
||||||
|
#
|
||||||
|
@home = File.expand_path("../..", File.dirname(__FILE__))
|
||||||
|
|
||||||
|
#
|
||||||
|
# 'require' should look in the scripts directory
|
||||||
|
#
|
||||||
|
$: << File.expand_path('scripts', @home)
|
||||||
|
|
||||||
|
#
|
||||||
|
# convenience methods to access files
|
||||||
|
#
|
||||||
|
def version_file(path)
|
||||||
|
"#{@home}/versions/#{@version_name}/#{path}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def distro_file(path)
|
||||||
|
"#{@home}/distros/#{@distro_name}/#{path}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def site_file(path)
|
||||||
|
"#{@home}/sites/#{@site_name}/#{path}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_file(path)
|
||||||
|
"#{@home}/testinfo/#{path}"
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# All of the scripts need to load these parms. (Except _setVersion and _setTest)
|
||||||
|
#
|
||||||
|
require 'subscripts/loadParms'
|
|
@ -1,6 +1,6 @@
|
||||||
require "#{File.dirname(__FILE__)}/_current_version"
|
require 'subscripts/_current_version'
|
||||||
require "#{File.dirname(__FILE__)}/_current_test"
|
require 'subscripts/_current_test'
|
||||||
require "/home/jeb228/LoadTesting/versions/#{@version_name}/version_properties"
|
require version_file('version_properties')
|
||||||
require "/home/jeb228/LoadTesting/distros/#{@distro_name}/distro_properties"
|
require distro_file('distro_properties')
|
||||||
require "/home/jeb228/LoadTesting/sites/#{@site_name}/site_properties"
|
require site_file('site_properties')
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue