Source Code Cross Referenced for Runner.java in  » Test-Coverage » Quilt » org » quilt » runner » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Test Coverage » Quilt » org.quilt.runner 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Runner.java */
002:
003:        package org.quilt.runner;
004:
005:        import java.io.BufferedReader;
006:        import java.io.PrintWriter;
007:        import java.io.StringReader;
008:        import java.io.StringWriter;
009:
010:        import junit.framework.*;
011:        import org.apache.tools.ant.util.StringUtils;
012:
013:        import org.quilt.framework.QuiltTest;
014:        import org.quilt.reports.Formatter;
015:
016:        /** 
017:         * Abstract class extended by Quilt test runners.
018:         */
019:        public abstract class Runner extends QuiltTest implements  RunnerConst,
020:                TestListener {
021:
022:            public abstract void run(); // constructor provides QuiltTest instance
023:
024:            public abstract int getRetCode();
025:
026:            // STATIC METHODS ///////////////////////////////////////////////
027:            public static String getFilteredTrace(Throwable t,
028:                    boolean filtertrace) {
029:                String trace = StringUtils.getStackTrace(t);
030:                return filterStack(trace, filtertrace);
031:            }
032:
033:            /////////////////////////////////////////////////////////////////
034:            // FOCUS  -- LOOK AT THIS CAREFULLY
035:            /////////////////////////////////////////////////////////////////
036:
037:            /**
038:             * Filters stack traces from Ant, Quilt, and JUnit classes.  These
039:             * are usually meaningless to users, who wants to concentrate on
040:             * their own code.
041:             */
042:            public static String filterStack(String stack, boolean filtertrace) {
043:                if (!filtertrace) {
044:                    return stack;
045:                }
046:                StringWriter sw = new StringWriter();
047:                PrintWriter pw = new PrintWriter(sw);
048:                StringReader sr = new StringReader(stack);
049:                BufferedReader br = new BufferedReader(sr);
050:
051:                String line;
052:                try {
053:                    while ((line = br.readLine()) != null) {
054:                        if (!filterLine(line)) {
055:                            pw.println(line);
056:                        }
057:                    }
058:                } catch (Exception IOException) {
059:                    return stack; // return the stack unfiltered
060:                }
061:                return sw.toString();
062:            }
063:
064:            private static boolean filterLine(String line) {
065:                for (int i = 0; i < DEFAULT_TRACE_FILTERS.length; i++) {
066:                    if (line.indexOf(DEFAULT_TRACE_FILTERS[i]) > 0) {
067:                        return true;
068:                    }
069:                }
070:                return false;
071:            }
072:
073:            // NON-STATIC METHODS ///////////////////////////////////////////
074:            /** Add a result formatter. */
075:            public abstract void addFormatter(Formatter f);
076:
077:            // TestListener INTERFACE ///////////////////////////////////////
078:            /** A failure (or error) has occurred. */
079:            public abstract void addFailure(Test test, Throwable t);
080:
081:            /** A failure (or error) has occurred. */
082:            public abstract void addFailure(Test test, AssertionFailedError t);
083:
084:            /** An unexpected error has occurred. */
085:            public abstract void addError(Test test, Throwable t);
086:
087:            /** Method called at start of individual test suite. */
088:            public abstract void startTest(Test t);
089:
090:            /** Method called at end of individual test run. */
091:            public abstract void endTest(Test test);
092:
093:            /** Process a block of output. */
094:            public abstract void handleOutput(String line);
095:
096:            /** Process an error message */
097:            public abstract void handleErrorOutput(String line);
098:
099:            /** Flush standard output. */
100:            public abstract void handleFlush(String line);
101:
102:            /** Flush the error output stream. */
103:            public abstract void handleErrorFlush(String line);
104:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.