Source Code Cross Referenced for JCLRuleSetTest.java in  » Development » SLF4J » org » slf4j » migrator » line » 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 » Development » SLF4J » org.slf4j.migrator.line 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.slf4j.migrator.line;
002:
003:        import org.slf4j.migrator.line.JCLRuleSet;
004:        import org.slf4j.migrator.line.LineConverter;
005:
006:        import junit.framework.TestCase;
007:
008:        public class JCLRuleSetTest extends TestCase {
009:
010:            LineConverter jclConverter = new LineConverter(new JCLRuleSet());
011:
012:            public void testImportReplacement() {
013:                // LogFactory import replacement
014:                assertEquals(
015:                        "import org.slf4j.LoggerFactory;",
016:                        jclConverter
017:                                .getOneLineReplacement("import org.apache.commons.logging.LogFactory;"));
018:                // Log import replacement
019:                assertEquals(
020:                        "import org.slf4j.Logger;",
021:                        jclConverter
022:                                .getOneLineReplacement("import org.apache.commons.logging.Log;"));
023:            }
024:
025:            public void testLogFactoryGetLogReplacement() {
026:                // Logger declaration and instanciation without modifier
027:                assertEquals(
028:                        "  Logger   l = LoggerFactory.getLogger(MyClass.class);",
029:                        jclConverter
030:                                .getOneLineReplacement("  Log   l = LogFactory.getLog(MyClass.class);"));
031:                // Logger declaration and instanciation with one modifier
032:                assertEquals(
033:                        "public Logger mylog=LoggerFactory.getLogger(MyClass.class);",
034:                        jclConverter
035:                                .getOneLineReplacement("public Log mylog=LogFactory.getLog(MyClass.class);"));
036:                // Logger declaration and instanciation with two modifier
037:                assertEquals(
038:                        "public static Logger mylog1 = LoggerFactory.getLogger(MyClass.class);",
039:                        jclConverter
040:                                .getOneLineReplacement("public static Log mylog1 = LogFactory.getLog(MyClass.class);"));
041:                // Logger declaration and instanciation with two modifier and comment at the
042:                // end of line
043:                assertEquals(
044:                        "public static Logger mylog1 = LoggerFactory.getLogger(MyClass.class); //logger instanciation and declaration",
045:                        jclConverter
046:                                .getOneLineReplacement("public static Log mylog1 = LogFactory.getLog(MyClass.class); //logger instanciation and declaration"));
047:                // Logger instanciation without declaration and comment at the end of line
048:                assertEquals(
049:                        " myLog = LoggerFactory.getLogger(MyClass.class);//logger instanciation",
050:                        jclConverter
051:                                .getOneLineReplacement(" myLog = LogFactory.getLog(MyClass.class);//logger instanciation"));
052:                // commented Logger declaration and instanciation with two modifier
053:                assertEquals(
054:                        "//public static Logger mylog1 = LoggerFactory.getLogger(MyClass.class);",
055:                        jclConverter
056:                                .getOneLineReplacement("//public static Log mylog1 = LogFactory.getLog(MyClass.class);"));
057:                // commented Logger instanciation without declaration
058:                assertEquals(
059:                        "// myLog = LoggerFactory.getLogger(MyClass.class);//logger instanciation",
060:                        jclConverter
061:                                .getOneLineReplacement("// myLog = LogFactory.getLog(MyClass.class);//logger instanciation"));
062:            }
063:
064:            public void testLogFactoryGetFactoryReplacement() {
065:
066:                // Logger declaration and instanciation without modifier
067:                assertEquals(
068:                        "Logger l = LoggerFactory.getLogger(MyClass.class);",
069:                        jclConverter
070:                                .getOneLineReplacement("Log l = LogFactory.getFactory().getInstance(MyClass.class);"));
071:                // Logger declaration and instanciation with one modifier
072:                assertEquals(
073:                        "public Logger mylog=LoggerFactory.getLogger(MyClass.class);",
074:                        jclConverter
075:                                .getOneLineReplacement("public Log mylog=LogFactory.getFactory().getInstance(MyClass.class);"));
076:                // Logger declaration and instanciation with modifiers
077:                assertEquals(
078:                        "public static Logger mylog1 = LoggerFactory.getLogger(MyClass.class);",
079:                        jclConverter
080:                                .getOneLineReplacement("public static Log mylog1 = LogFactory.getFactory().getInstance(MyClass.class);"));
081:                // Logger declaration and instanciation with two modifier and comment at the
082:                // end of line
083:                assertEquals(
084:                        "public static Logger mylog1 = LoggerFactory.getLogger(MyClass.class); //logger instanciation and declaration",
085:                        jclConverter
086:                                .getOneLineReplacement("public static Log mylog1 = LogFactory.getFactory().getInstance(MyClass.class); //logger instanciation and declaration"));
087:                // Logger instanciation without declaration and comment at the end of line
088:                assertEquals(
089:                        " myLog = LoggerFactory.getLogger(MyClass.class);//logger instanciation",
090:                        jclConverter
091:                                .getOneLineReplacement(" myLog = LogFactory.getFactory().getInstance(MyClass.class);//logger instanciation"));
092:                // commented Logger declaration and instanciation with two modifier
093:                assertEquals(
094:                        "//public static Logger mylog1 = LoggerFactory.getLogger(MyClass.class);",
095:                        jclConverter
096:                                .getOneLineReplacement("//public static Log mylog1 = LogFactory.getFactory().getInstance(MyClass.class);"));
097:                // commented Logger instanciation without declaration
098:                assertEquals(
099:                        "// myLog = LoggerFactory.getLogger(MyClass.class);//logger instanciation",
100:                        jclConverter
101:                                .getOneLineReplacement("// myLog = LogFactory.getFactory().getInstance(MyClass.class);//logger instanciation"));
102:            }
103:
104:            public void testLogDeclarationReplacement() {
105:
106:                // simple Logger declaration
107:                assertEquals("Logger mylog;", jclConverter
108:                        .getOneLineReplacement("Log mylog;"));
109:                // Logger declaration with a modifier
110:                assertEquals("private Logger mylog;", jclConverter
111:                        .getOneLineReplacement("private Log mylog;"));
112:
113:                // Logger declaration with modifiers
114:                assertEquals(
115:                        "public static final Logger myLog;",
116:                        jclConverter
117:                                .getOneLineReplacement("public static final Log myLog;"));
118:                // Logger declaration with modifiers and comment at the end of line
119:                assertEquals(
120:                        "public Logger myLog;//logger declaration",
121:                        jclConverter
122:                                .getOneLineReplacement("public Log myLog;//logger declaration"));
123:                // commented Logger declaration
124:                assertEquals("//private Logger myLog;", jclConverter
125:                        .getOneLineReplacement("//private Log myLog;"));
126:            }
127:
128:            public void testMultiLineReplacement() {
129:                // Logger declaration on a line
130:                assertEquals("protected Logger log =", jclConverter
131:                        .getOneLineReplacement("protected Log log ="));
132:
133:                // Logger instanciation on the next line
134:                assertEquals(
135:                        " LoggerFactory.getLogger(MyComponent.class);",
136:                        jclConverter
137:                                .getOneLineReplacement(" LogFactory.getLog(MyComponent.class);"));
138:                // Logger declaration on a line
139:                assertEquals("protected Logger log ", jclConverter
140:                        .getOneLineReplacement("protected Log log "));
141:                // Logger instanciation on the next line
142:                assertEquals(
143:                        " = LoggerFactory.getLogger(MyComponent.class);",
144:                        jclConverter
145:                                .getOneLineReplacement(" = LogFactory.getFactory().getInstance(MyComponent.class);"));
146:            }
147:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.