summaryrefslogtreecommitdiffstats
path: root/java/etc/listignores.rb
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /java/etc/listignores.rb
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/etc/listignores.rb')
-rw-r--r--java/etc/listignores.rb126
1 files changed, 126 insertions, 0 deletions
diff --git a/java/etc/listignores.rb b/java/etc/listignores.rb
new file mode 100644
index 0000000000..f983dcb296
--- /dev/null
+++ b/java/etc/listignores.rb
@@ -0,0 +1,126 @@
+=begin
+
+Scans java test source files, recursively from the current directory,
+looking for ignored test methods producing a list of such test methods
+and their associated blocking Jiras.
+
+The implementation makes heavy use of my scant knowledge of regex. I'll
+comeback and clean this up as time allows.
+
+Only proceses testfiles and assumes they are named like: *TestCase.java
+
+Assumes a test annotation convention like this:
+
+ @Ignores("TUSCANY-xxxx")
+ public void someTest() throws Exception {
+
+Example command line usage
+>ruby listignores.rb > scan.txt
+
+Current output is formatted as normal text
+
+=end
+class TestMethod
+
+ def initialize(text, parent)
+ @text = text
+ @parent = parent
+ end
+
+ def name
+ regex = /void\s*\S*\(\) /
+ str = @text[regex]
+ str.sub(/void\s*/, '')
+ end
+
+ def ignore_line
+ @text[/^\s*@Ignore.*/]
+ end
+
+ def jira
+ result = ignore_line
+ result = result[/\d{4,5}/]
+ result ? ", T-" + result : ", no associated jira"
+ end
+
+ def ignore_string
+ ignore_line ? jira : ""
+ end
+
+ def to_s
+ self.name + ignore_string + "\n"
+ end
+end
+
+class TestCase
+ attr_accessor :text, :ignored_methods
+
+ def initialize(text)
+ @text = text
+ @ignored_methods = Array.new
+ create_ignored_methods
+ end
+
+ def create_ignored_methods
+ regex = /@Ignore.*?\{/m
+ test_method_text_array = text.scan(regex)
+ test_method_text_array.each do |t|
+ @ignored_methods<<TestMethod.new(t, self)
+ end
+ end
+
+ def package_name
+ line = @text[/pack.*$/]
+ line.sub!(/package /, '')
+ line.sub(/;/, '')
+ end
+
+ def testcase_name
+ text[/\S*TestCase/]
+ end
+
+ def long_name
+ package_name + "." + testcase_name
+ end
+
+ def has_ignored_methods
+ @ignored_methods.size > 0
+ end
+
+end
+
+def process_file(fn)
+ text = String.new
+ File.open(fn) { |f| text = f.read }
+ $testcases << TestCase.new(text)
+end
+
+$testcases = Array.new
+svn_info = `svn info`
+svn_revision = svn_info[/Revision: \d*/]
+
+Dir["**/*TestCase.java"].each do |filename|
+ process_file(filename)
+end
+
+puts "Content generated by from #{Dir.pwd}"
+puts "Test case files scanned " + Date.today.to_s + " (svn:" + svn_revision + ")"
+puts "* Total files processed = #{$testcases.size}"
+num_ignored = 0
+$testcases.each {|c|num_ignored = num_ignored + c.ignored_methods.size}
+puts "* Total ingnored test cases = " + num_ignored.to_s
+puts ""
+
+puts "The following test cases have ignored test methods ..."
+puts ""
+cases = $testcases.select{|c| c.has_ignored_methods}
+cases.each do |c|
+ puts c.long_name
+ c.ignored_methods.each {|m| puts " " + m.to_s}
+ puts ""
+end
+
+
+
+
+