Author: kwilliams
Date: Thu May 22 17:24:41 2008
New Revision: 659330
URL: http://svn.apache.org/viewvc?rev=659330&view=rev
Log:
Some comment clean and update to comment processor script
Modified:
incubator/tuscany/java/sca/vtest/java-api/annotations/conversational/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/ConversationAnnotationTestCase.java
incubator/tuscany/java/sca/vtest/java-api/processcomments.rb
Modified:
incubator/tuscany/java/sca/vtest/java-api/annotations/conversational/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/ConversationAnnotationTestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/conversational/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/ConversationAnnotationTestCase.java?rev=659330&r1=659329&r2=659330&view=diff
==============================================================================
---
incubator/tuscany/java/sca/vtest/java-api/annotations/conversational/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/ConversationAnnotationTestCase.java
(original)
+++
incubator/tuscany/java/sca/vtest/java-api/annotations/conversational/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/ConversationAnnotationTestCase.java
Thu May 22 17:24:41 2008
@@ -74,6 +74,14 @@
Assert.assertNotSame(thisState, aService.setThenGetB1State(thisState));
}
+ /**
+ * Line 325-327:<br>
+ * <p>
+ * Java service interfaces may be annotated to specify whether their
+ * contract is conversational as described in the Assembly Specification
+ * by using the "@Conversational" annotation. A conversational service
+ * indicates that requests to the service are correlated in some way
+ */
@Test
public void atConversation2() throws Exception {
String thisState = "This State";
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=659330&r1=659329&r2=659330&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/processcomments.rb (original)
+++ incubator/tuscany/java/sca/vtest/java-api/processcomments.rb Thu May 22
17:24:41 2008
@@ -1,32 +1,48 @@
-# Scans files - with a given extension - recursively from the current
-# directory replacing the old copyright/license header statement with a
-# new version
+# Scans files - with a java extension - recursively from the current
+# directory processing test method comments. Eventually, this will produce a
sorted
+# list of specification line numbers and their associated test methods
#
# Example command line usage
-# >ruby replaceheaders.rb java oldheader.txt newheader.txt
+# >ruby processcomments.rb
class TestMethod
attr_accessor :text, :parent
def initialize(text, parent)
+ puts "Test method text => " + text
@text = text
@parent = parent
end
def name
- #puts @text
- regex = /\S*\(\) /
+ regex = /void\s*\S*\(\) /
@text[regex]
end
+ def lines_tested
+ lines_regex = /Line.*?$/
+ lines_array = text.scan(lines_regex)
+ nums_regex = /\d{1,4}/
+ line_numbers = Array.new
+ lines_array.each do |line_text|
+ number_strings =line_text.scan(nums_regex)
+ number_strings.each {|num_string| line_numbers<<num_string.to_i}
+ end
+ line_numbers
+ end
+
+ def lines_tested_string
+ lts = String.new
+ lines_tested.each {|n| lts = lts +"," + n.to_s }
+ lts
+ end
+
def package_name
@parent.package_name
end
def long_name
- #puts "Here's the package name =>" + self.package_name
- #puts "Here's the self name =>" + self.name
self.package_name + "." + self.name
end
end
@@ -40,6 +56,16 @@
create_test_methods
end
+ def create_test_methods
+ #regex = /\/\*\*.*?$\W*?Line.*?\{/m
+ regex = /\/\*\*\W*?$\W*?Line.*?\{/m
+ test_method_text_array = text.scan(regex)
+ test_method_text_array.each do |t|
+ @test_methods<<TestMethod.new(t, self)
+ $num_test_methods +=1
+ end
+ end
+
def package_name
line = @text[/pack.*$/]
line.sub!(/package /, '')
@@ -49,26 +75,16 @@
def testcase_name
text[/\S*TestCase/]
end
-
- def create_test_methods
- #/**
- #regex = /Line.*?\{/m
- regex = /\/\*\*.*?$\W*?Line.*?\{/m
-
- test_method_text_array = text.scan(regex)
- test_method_text_array.each {|t| @test_methods<<TestMethod.new(t, self)}
- end
-
end
- def process_file(fn)
- text = String.new
- File.open(fn) { |f| text = f.read }
- $testcases << TestCase.new(text)
- end
+def process_file(fn)
+ text = String.new
+ File.open(fn) { |f| text = f.read }
+ $testcases << TestCase.new(text)
+end
-$num_files_processed = 0
+$num_files_processed = $num_test_methods = 0
$testcases = Array.new
puts "Scanning files with .java extension"
@@ -80,12 +96,25 @@
puts "Total files processed = #{$num_files_processed}"
puts "Number of test cases = #{$testcases.length}"
+puts "Number of test methods = #{$num_test_methods}"
+
$testcases.each do |tc|
- puts "Next Test Class =>" + tc.package_name + tc.testcase_name
- tc.test_methods.each {|m| puts " " + m.long_name}
+ puts "Next Test Class =>" + tc.package_name + "." + tc.testcase_name
+ tc.test_methods.each {|m| puts " " + m.long_name + "lines => " +
m.lines_tested_string }
end
-
+puts "************* Here we go *******************"
+$testcases.each do |tc|
+ all_test_methods = Array.new
+ tc.test_methods.each {|m| all_test_methods<<m}
+
+
+ all_test_methods.sort!{|a, b| a.lines_tested.first <=> b.lines_tested.first}
+ all_test_methods.each {|tm| puts tm.lines_tested.first.to_s}
+
+ #sorted = all_test_methods.sort_by { |m| m.lines_tested.first }
+ #sorted.each {|tm| puts tm.lines_tested.to_s}
+end