Author: kwilliams
Date: Thu May 29 15:12:33 2008
New Revision: 661503

URL: http://svn.apache.org/viewvc?rev=661503&view=rev
Log:
Small changes to comment processor

Modified:
    incubator/tuscany/java/sca/vtest/java-api/processcomments.rb

Modified: incubator/tuscany/java/sca/vtest/java-api/processcomments.rb
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/processcomments.rb?rev=661503&r1=661502&r2=661503&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/processcomments.rb (original)
+++ incubator/tuscany/java/sca/vtest/java-api/processcomments.rb Thu May 29 
15:12:33 2008
@@ -1,7 +1,10 @@
 =begin
 
 Scans java test source files, recursively from the current directory,
-and produces a list of test metods sorted by specification line number
+and produces a list of test metods sorted by specification line number.
+
+The implementation makes heavy use of my scant knowledge of regex.  I'll
+comeback and clean this up as time allows.
 
 Assumes a test comment convention like this:
 
@@ -17,15 +20,13 @@
     @Test
     public void atEndsConversation1() throws Exception {
 
-Current output is formatted for a wiki page
-
 Example command line usage
->ruby processcomments.rb 
+>ruby processcomments.rb > comment_scan.txt
+
+Current output is formatted for a cwiki page and can be directly pasted to a 
blank page
 
 Some TODO's:
   Add logic to process number ranges such as "Lines 523-556" or "Lines 523 to 
556"
-  Provide HTML output
-
 =end
 class TestMethod
   
@@ -97,8 +98,8 @@
     long_name  + "\n" + "Lines tested: " + lines_tested_string + "\n\n"
   end
   
-  def to_wiki_s
-    lines_tested_string + "|" + long_name + "|" + ignore_string + "\n"
+  def to_cwiki_s
+    "|" + lines_tested_string + "|" + long_name + "|" + ignore_string + "|\n"
   end
 end
 
@@ -137,8 +138,20 @@
   $testcases << TestCase.new(text)
 end
 
+def spec_tested (dir_pwd)
+  subfolder_name = dir_pwd[/\/[^\/\\]*$/]
+  subfolder_name = subfolder_name[1..subfolder_name.length-1]
+  result = case subfolder_name
+    when "java-api" : "SCA Java Common Annotations and APIs V1.00"
+    when "wsbinding" : "SCA Web Services Binding V1.00"
+    else "Unknown!"
+    end
+end
+
 $num_files_processed = $num_test_methods = 0
 $testcases = Array.new
+svn_info = `svn info`
+svn_revision = svn_info[/Revision: \d*/]
 
 Dir["**/*TestCase.java"].each do |filename|
   process_file(filename)
@@ -150,25 +163,16 @@
   tc.test_methods.each {|m| all_test_methods<<m}
 end
 
-#Regular screen dump
-#puts "Scanned test files for " + Dir.pwd
-#puts "Total files processed = #{$num_files_processed}"
-#puts "Number of test cases = #{$testcases.length}"
-#puts "Number of test methods = #{$num_test_methods}"
-#all_test_methods.sort.each {|tm| puts tm}
-
-#wiki output
-puts "1 SCA Specification Test mapping (Comment Processor Output)"
-puts "1.1 " + Dir.pwd + " Specification"
-puts "1.1 Test case files scanned " + Date.today.to_s
+#confluence wiki output
+puts "Content generated by /vtest/processcomments.rb"
+puts "h1. " + spec_tested(Dir.pwd) + " - Test map"
+puts "h3. Test case files scanned " + Date.today.to_s + " (svn:" + 
svn_revision + ")"
 puts "* Total files processed = #{$num_files_processed}"
 puts "* Number of test cases = #{$testcases.length}"
 puts "* Number of test methods = #{$num_test_methods}"
 
-puts "{table}"
-puts "Lines Tested| package/testcase/method |ignored"
-all_test_methods.sort.each {|tm| puts tm.to_wiki_s}
-puts "{table}"
+puts "||Specification Line Numbers|| package/testcase/method ||ignored||"
+all_test_methods.sort.each {|tm| puts tm.to_cwiki_s}
 
 
 


Reply via email to