Source Code Cross Referenced for JBlanketAppTask.java in  » Code-Analyzer » JBlanket » csdl » jblanket » ant » 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 » Code Analyzer » JBlanket » csdl.jblanket.ant 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package csdl.jblanket.ant;
002:
003:        import csdl.jblanket.modifier.MethodCollector;
004:
005:        import java.io.File;
006:        import java.util.ArrayList;
007:
008:        /**
009:         * Implements the JBlanket Apache Ant task definition that launches the application to exclude
010:         * individual methods.  The system covered is displayed as a tree, with methods as the leaves.  The
011:         * Font used to display each method is altered to reflect the category of the method, e.g., tested,
012:         * untested, one-line, etc.  Methods chosen to be excluded by the user within this application are
013:         * stored in the directory specified by the jblanket.dir system property.  If not set, the default
014:         * directory is <user_home>/<user_account>/jblanket/.
015:         * <p>
016:         * <b>Required</b> nested element for the application task:
017:         * <ul>
018:         * <p>
019:         * None.
020:         * </ul>
021:         * <p>
022:         * <b>Optional</b> nested element for the application task:
023:         * <ul>
024:         * <p>
025:         * 'sysproperty' - describes additional system properties not set in the environment.  If
026:         *                 jblanket.dir is not set as an environment variable, include this nested element
027:         *                 to set it.
028:         * <i>For example</i>: see <a href="http://jakarta.apache.org/ant/manual/index.html">Ant</a>
029:         * </ul>
030:         * <p>
031:         * <b>Required</b> attribute for the application task:
032:         * <ul>
033:         * <p>
034:         * None.
035:         * </ul>
036:         * <p>Optional</b> attributes for the application task:
037:         * <ul>
038:         * <p>
039:         * 'enable' - describes if the application should be launched.  Valid values include "true", "on",
040:         *            "yes" to launch the application or "false", "off", or "no" to not launch the
041:         *            application.
042:         * <i>For example</i>: enable="true"
043:         * <p>
044:         * 'verbose' - describes if additional output should be sent to standard out.
045:         *             Valid values include "true", "on", "yes" for additional output
046:         *             or "false", "off", or "no" for no additional output.<br>
047:         * <i>For example</i>: verbose="false"
048:         * <p>
049:         * 'excludeonelinemethods' - describes if methods with one line of code were excluded from coverage.
050:         *                           Values include "true", "on", "yes" to identify the one-line methods
051:         *                           or "false", "off", or "no" to not identify them.<br>
052:         * <i>For example</i>: excludeonelinemethods="false"
053:         * <p>
054:         * 'excludeconstructors' - describes if constructors were excluded from coverage.  Values include
055:         *                         "true", "on", "yes" to identify constructors or "false", "off",
056:         *                         or "no" to not identify them.<br>
057:         * <i>For example</i>: excludeconstructors="false"
058:         * <p>
059:         * 'onelinefile' - name of XML file containing all one-line methods<br>
060:         * <i>For example</i>: onelinefile="oneLineMethods.xml"
061:         * <p>
062:         * 'constructorfile' - name of XML file containing all cosntructors<br>
063:         * <i>For example</i>: constructorfile="constructorsMethods.xml"
064:         * <p>
065:         * 'excludedindividualfile' - name of XML file to contain/containing all individually excluded
066:         *                            methods<br>
067:         * <i>For example</i>: excludedindividualfile="excludedIndividualMethods.xml"
068:         * </ul>
069:         * <p>
070:         * If any of the optional attributes are not specified, their default values specified in the
071:         * examples are used.  For example, to distinguish methods with one line of source code from the
072:         * coverage measurement, specify the 'excludeonelinemethods' attribute with a 'true' value.
073:         * When not specified, one-line methods will not be distinguished in the application.
074:         * <p>
075:         * Use this class to execute JBlanket with Ant.  One example of the 'jblanketapp' Ant target is:
076:         * <pre>
077:         * &lt;taskdef name="jblanketapp" classname="csdl.jblanket.ant.JBlanketAppTask"/&gt;
078:         * &lt;jblanketapp&gt;
079:         *   &lt;sysproperty key="jblanket.dir" value="$jblanket.dir" /&gt;
080:         * &lt;/jblanketapp&gt;
081:         * </pre>
082:         * From the example, only tested and untested methods from the files found in jblanket.dir are
083:         * distinguished.  No additional output will be sent to standard out.
084:         * <p>
085:         * Another example is:
086:         * <pre>
087:         * &lt;jblanketapp excludeonelinemethods="true"
088:         *              verbose="true" /&gt;
089:         * </pre>
090:         * where one-line methods are distinguished, but constructors are not.  Additional output will be
091:         * sent to standard out.
092:         * <p>
093:         * Individually excluded methods are always identified.  Only the file in which they are stored can
094:         * be changed.
095:         * <p>
096:         * NOTE: For JBlanket to successfully launch the application, all related files MUST exist in
097:         * jblanket.dir.
098:         * 
099:         * @author Joy M. Agustin
100:         * @version $Id: JBlanketAppTask.java,v 1.1 2004/11/07 00:32:33 timshadel Exp $
101:         */
102:        public class JBlanketAppTask extends JBlanketTask {
103:
104:            /**
105:             * Constructs a new JBlanketAppTask object.
106:             */
107:            public JBlanketAppTask() {
108:                super ();
109:            }
110:
111:            /**
112:             * Executes the application for excluding individual methods Ant taskdef.
113:             */
114:            public void execute() {
115:
116:                // Return without launching application if jblanketapp is disabled.
117:                if (!super .enable) {
118:                    if (super .verbose) {
119:                        System.out
120:                                .println("jblanketapp disabled; application was not launched.");
121:                    }
122:                    return;
123:                }
124:                // Format JBlanketApp arguments.
125:                ArrayList argsList = new ArrayList();
126:
127:                // format the required arguments
128:                argsList.add("java");
129:                argsList.add("-D\"jblanket.dir\"="
130:                        + MethodCollector.getJBlanketDir());
131:
132:                // add classpath
133:                argsList.add("-classpath");
134:                String slash = File.separator;
135:                String antLib = System.getProperty("ant.home") + slash + "lib"
136:                        + slash;
137:                String classPath = ".;" + antLib + "jblanket.jar;" + antLib
138:                        + "jdom.jar;" + antLib + "xerces.jar";
139:                argsList.add(classPath);
140:                argsList.add("csdl.jblanket.app.ExcludeIndividualMethodApp");
141:
142:                // add verbose
143:                argsList.add("-verbose");
144:                argsList.add(new Boolean(super .verbose).toString());
145:
146:                // add oneLineFile if user specified
147:                if (super .excludeOneLineMethods) {
148:                    argsList.add("-excludeOneLineMethods");
149:                    argsList.add(new Boolean(super .excludeOneLineMethods)
150:                            .toString());
151:                    if (super .oneLineFile != null) {
152:                        argsList.add("-oneLineFile");
153:                        argsList.add(super .oneLineFile);
154:                    }
155:                }
156:
157:                // add contructorFile if user specified
158:                if (super .excludeConstructors) {
159:                    argsList.add("-excludeConstructors");
160:                    argsList.add(new Boolean(super .excludeConstructors)
161:                            .toString());
162:                    if (super .constructorFile != null) {
163:                        argsList.add("-constructorFile");
164:                        argsList.add(super .constructorFile);
165:                    }
166:                }
167:
168:                // add excludedIndividualFile if user specified
169:                if (super .excludedIndividualFile != null) {
170:                    argsList.add("-excludedIndividualFile");
171:                    argsList.add(super .excludedIndividualFile);
172:                }
173:
174:                // add total tested and untested methods
175:                argsList.add("-total.testedFile");
176:                argsList.add("-total.untestedFile");
177:
178:                String[] args = (String[]) argsList.toArray(new String[argsList
179:                        .size()]);
180:
181:                //TODO write out Exceptions to a Log, and print error messages to the screen
182:                Runtime runtime = Runtime.getRuntime();
183:                try {
184:                    runtime.exec(args);
185:                } catch (Exception e) {
186:                    e.printStackTrace();
187:                }
188:            }
189:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.