Source Code Cross Referenced for AbstractByteCodeSnippetFactory.java in  » Test-Coverage » NoUnit » net » firstpartners » nounit » reader » bytecode » 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 » NoUnit » net.firstpartners.nounit.reader.bytecode 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.firstpartners.nounit.reader.bytecode;
002:
003:        /**
004:         * Title:        NoUnit - Identify Classes that are not being unit Tested
005:         *
006:         * Copyright (C) 2001  Paul Browne , FirstPartners.net
007:         *
008:         *
009:         * This program is free software; you can redistribute it and/or 
010:         * modify it under the terms of the GNU General Public License
011:         * as published by the Free Software Foundation; either version 2
012:         * of the License, or (at your option) any later version.
013:         *
014:         * This program is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
017:         * GNU General Public License for more details.
018:         *
019:         * You should have received a copy of the GNU General Public License
020:         * along with this program; if not, write to the Free Software
021:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
022:         *
023:         * @author Paul Browne
024:         * @version 0.7
025:         */
026:
027:        import java.util.HashMap;
028:        import java.util.Iterator;
029:
030:        import net.firstpartners.nounit.reader.ISnippetFactory;
031:        import net.firstpartners.nounit.snippet.Snippets;
032:        import net.firstpartners.nounit.utility.NoUnitException;
033:        import net.firstpartners.nounit.utility.TextUtil;
034:
035:        /**
036:         * Implements ISnippetFactory for Convience of Subclasses
037:         */
038:        abstract public class AbstractByteCodeSnippetFactory implements 
039:                ISnippetFactory {
040:
041:            /**
042:             * Get the Collection of Snippets (as read from the source)
043:             * @return Snippets
044:             */
045:            abstract public Snippets getSnippets() throws NoUnitException;
046:
047:            /**
048:             * Clean the Hashset of values to get useful names
049:             * @param dirtyValues to be cleaned
050:             * @return cleanValues - i.e. proper class names
051:             */
052:            protected HashMap cleanValues(HashMap dirtyValues) {
053:
054:                //Local Variables
055:                String tmpKey;
056:                String tmpValue;
057:                Iterator keys = dirtyValues.keySet().iterator();
058:                HashMap cleanValues = new HashMap();
059:
060:                while (keys.hasNext()) {
061:
062:                    //Get
063:                    tmpKey = (String) keys.next();
064:                    tmpValue = (String) dirtyValues.get(tmpKey);
065:
066:                    //Clean
067:                    tmpValue = cleanValues(tmpValue);
068:
069:                    // put into output
070:                    cleanValues.put(tmpKey, tmpValue);
071:                }
072:
073:                return cleanValues;
074:
075:            }
076:
077:            /**
078:             * Clean the Hashset of values to get useful names
079:             * @param valueToClean to be cleaned
080:             * @return valueToClean now with proper class names
081:             */
082:            public String cleanValues(String valueToClean) {
083:
084:                //check for null
085:                if (valueToClean == null)
086:                    return "";
087:
088:                //Get rid of .
089:                valueToClean = TextUtil.removeAll(valueToClean, ".");
090:
091:                //Change / to .
092:                valueToClean = TextUtil.replaceAll(valueToClean, "/", ".");
093:
094:                //Get rid of (
095:                valueToClean = TextUtil.removeAll(valueToClean, "(");
096:
097:                //get rid of )
098:                valueToClean = TextUtil.removeAll(valueToClean, ")");
099:
100:                //remove L at start
101:                if (valueToClean.startsWith("L")) {
102:
103:                    valueToClean = valueToClean.substring(1, valueToClean
104:                            .length());
105:
106:                }
107:
108:                //remove . at start
109:                if (valueToClean.startsWith(".")) {
110:
111:                    valueToClean = valueToClean.substring(1, valueToClean
112:                            .length());
113:
114:                }
115:
116:                return valueToClean;
117:            }
118:
119:            /**
120:             * Tidy the Method and Class names
121:             * @param inString to be tidied
122:             * @return String , tidied up
123:             */
124:            protected String tidyNames(String inString) {
125:
126:                String returnString = TextUtil.removeAll(inString, " ");
127:                returnString = TextUtil.removeAll(inString, "<");
128:                returnString = TextUtil.removeAll(inString, ">");
129:
130:                //remove space at start
131:                if (returnString.startsWith(" ")) {
132:
133:                    returnString = returnString.substring(1, returnString
134:                            .length());
135:
136:                }
137:
138:                //remove . at start
139:                if (returnString.startsWith(".")) {
140:
141:                    returnString = returnString.substring(1, returnString
142:                            .length());
143:
144:                }
145:
146:                //remove < at start
147:                if (returnString.startsWith("<")) {
148:
149:                    returnString = returnString.substring(1, returnString
150:                            .length());
151:
152:                }
153:
154:                //Now replace / with .
155:                returnString = TextUtil.replaceAll(returnString, "/", ".");
156:
157:                return returnString;
158:
159:            }
160:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.